#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; using Pll = pair; using Pii = pair; constexpr ll MOD = 1000000007; constexpr long double EPS = 1e-10; constexpr int dyx[4][2] = { { 0, 1}, {-1, 0}, {0,-1}, {1, 0} }; int main() { int n, winner; cin >> n; vector v(2, -1), lose(n+1, -1), cand; for(int i=0;i 1) { vector next_cand; for(int i=0;i> winner; next_cand.push_back(winner); if(winner == cand[i]) { lose[cand[i+1]] = cand[i]; } else { lose[cand[i]] = cand[i+1]; } } swap(cand, next_cand); } v[0] = cand[0]; cand.clear(); for(int i=1;i<=n;++i) { if(lose[i] == v[0]) { cand.push_back(i); } } while(cand.size() > 1) { vector next_cand; for(int i=0;i> winner; next_cand.push_back(winner); } swap(cand, next_cand); } cout << "! " << cand[0] << endl; }