#include using namespace std; #define ALL(x) begin(x),end(x) #define rep(i,n) for(int i=0;i<(n);i++) #define debug(v) cout<<#v<<":";for(auto x:v){cout<bool chmax(T &a,const T &b){if(abool chmin(T &a,const T &b){if(b ostream &operator<<(ostream &os,const vector&v){ for(int i=0;i<(int)v.size();i++) os< istream &operator>>(istream &is,vector&v){ for(T &x:v)is>>x; return is; } int Q=0; int query(int a,int b){ assert(Q<=350); Q++; cout<<"? "<>res;res--; return res; } signed main(){ int n;cin>>n; int sz=1; while(sz> v(sz*2); vector ord(n); iota(ALL(ord),0); mt19937 mt(chrono::steady_clock::now().time_since_epoch().count()); shuffle(ALL(ord),mt); rep(i,n) v[i+sz].push_back(ord[i]); auto f=[&](int l,int r){ if(__builtin_popcount(l^r)%2) swap(l,r); vector ret; for(int i=0,j=0;i=2) break; int win=-1; if(i==v[l].size()) win=v[r][j++]; else if(j==v[r].size()) win=v[l][i++]; else{ win=query(v[l][i],v[r][j]); if(win==v[l][i]) i++; else j++; } ret.push_back(win); } return ret; }; for(int k=sz-1;k>0;k--) v[k]=f(2*k,2*k+1); cout<<"! "<