#pragma GCC optimize("Ofast") #include using namespace std; using i64=int_fast64_t; using pii=pair; using pll=pair; template constexpr T inf=numeric_limits::max() / (T)2; template using heap=priority_queue; template using minheap=priority_queue,greater>; #define fir first #define sec second #define mkp make_pair #define mkt make_tuple #define emb emplace_back #define emp emplace #define all(v) begin(v),end(v) namespace std { template void hash_combine(size_t &seed, T const &key) { seed ^= hash()(key) + 0x9e3779b9 + (seed << 6) + (seed >> 2); } template struct hash> { size_t operator()(pair const &pr) const { size_t seed = 0; hash_combine(seed,pr.first); hash_combine(seed,pr.second); return seed; } }; } void ios_untie() { ios::sync_with_stdio(false); cin.tie(nullptr); } void file_setup() { if(!freopen("stderr.txt","wt",stderr)) { std::cerr << "Failed to open the stderr file\n"; freopen("CON","wt",stderr); } if(!freopen("stdout.txt","wt",stdout)) { std::cerr << "Failed to open the stdout file\n"; freopen("CON","wt",stdout); } if(!freopen("stdin.txt","rt",stdin)) { std::cerr << "Failed to open the stdin file.\n"; freopen("CON","rt",stdin); } } template void init(A (&array)[N], const T &val) { fill((T*)array,(T*)(array + N),val); } i64 binry(i64 ok, i64 ng, const function &f) { while(abs(ok-ng)>1) { i64 mid=(ok+ng)/2; (f(mid) ? ok : ng) = mid; } return ok; } const int __n=512; int n; int dat[1024]; int merge(int x,int y) { int ret; if(y<=n) { cout<<"? "<>ret; } else { ret=x; } return ret; } void solve() { for(int i=__n,t=1; i<__n*2; ++i,++t) { dat[i]=t; } for(int i=__n-1; i; --i) { dat[i]=merge(dat[i*2],dat[i*2+1]); } int _max=dat[1]; int ix=_max-1+__n; dat[ix]=n+1; while(ix>>=1) { dat[ix]=merge(dat[ix*2],dat[ix*2+1]); } cout<<"! "<>n; solve(); }