#include <bits/stdc++.h>
#define ll long long
using namespace std;
bool ask (int x)
{
    bool tf; cin>>tf;
    return tf;
}
int find_number (int MAX)
{
    int l=0, r=MAX;
    while (l<r)
    {
        int mid=l+(r-l)/2;
        if (ask(mid))
        {
            r=mid-1;
        }
        else l=mid;
    }
    return l;
}