bool smaller(int x);
int find_number(int MAX)
{
    int l = 1, d = MAX, s;
    while (l < d-1)
    {
        s = l+(d-l)/2;
        if (smaller(s))
        {
            d = s-1;
        }
        else
        {
            l = s;
        }
    }
    if (smaller(d)) return l;
    else return d;
}