#define _USE_MATH_DEFINES #include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define MT make_tuple #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)<; using vi = vector; using vll = vector; int query(int x, int y) { if (y == 0)return x; cout << "? " << x << ' ' << y << endl; int res; cin >> res; return res; } int N; vi lost[301]; // (l, r] int f(int l, int r) { if (r - l == 1) { if (r > N)return 0; else return r; } int m = (l + r) / 2; int x = f(l, m); int y = f(m, r); int res = f(x, y); lost[res].push_back(res^x^y); return res; } void solve() { cin >> N; int n = 1; while (n < N)n *= 2; int champ = f(0, n); int sec = lost[champ][0]; FOR(i, 1, sz(lost[champ])) { sec = query(sec, lost[champ][i]); } cout << "! " << sec << endl; } int main() { solve(); return 0; }