#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
using namespace std;
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define snuke(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
int Q = 0;
int sum[1010];
int q[1010][1010];
int query(int L, int R){
if(q[L][R] != -1) return q[L][R];
/* printf("? %d %d\n", L + 1, R);
fflush(stdout);
int ans;
scanf("%d", &ans); */
int ans = sum[R] - sum[L];
if(rand() % 2 == 0) ans = rand() % (R - L + 1);
Q++;
return q[L][R] = ans;
}
int get_char(int id){
int i;
int zero = 0, one = 0;
int L = id;
int R = id + 1;
if(id < 500){
for(i=1000;;i--){
int tmp = query(L, i) - query(R, i);
if(tmp == 0) zero++;
if(tmp == 1) one++;
if(abs(zero - one) >= 3) break;
}
} else {
for(i=0;;i++){
int tmp = query(i, R) - query(i, L);
if(tmp == 0) zero++;
if(tmp == 1) one++;
if(abs(zero - one) >= 3) break;
}
}
return ((zero > one) ? 0 : 1);
}
int main(void){
int i,j;
srand(314422);
REP(i,1000) sum[i+1] = sum[i] + rand() % 2;
REP(i,1010) REP(j,1010) q[i][j] = -1;
string ans;
REP(i,1000) ans += (char)('0' + get_char(i));
// cout << "! " << ans << endl;
cout << Q << endl;
int tmp = 0;
REP(i,1000){
tmp += ans[i] - '0';
if(tmp != sum[i+1]) cout << "angry" << endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3N0cmVhbT4KI2luY2x1ZGUgPGZzdHJlYW0+CiNpbmNsdWRlIDxzdHJpbmc+CiNpbmNsdWRlIDx2ZWN0b3I+CiNpbmNsdWRlIDxkZXF1ZT4KI2luY2x1ZGUgPHF1ZXVlPgojaW5jbHVkZSA8c3RhY2s+CiNpbmNsdWRlI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