#include using i64 = long long; int ask(int a, int b) { printf("? %d %d\n", a, b); fflush(stdout); int ret; scanf("%d", &ret); return ret; } int main() { int n; scanf("%d", &n); std::vector cs; for (int i = 1; i <= n; i++) cs.push_back(i); std::vector> wl(n + 1, std::vector(n + 1)); while (cs.size() > 1) { std::vector next; for (int i = 1; 2 * i - 1 < cs.size(); i++) { int w = ask(cs[2 * i - 2], cs[2 * i - 1]); int l = cs[2 * i - 2] ^ cs[2 * i - 1] ^ w; next.push_back(w); wl[w][l] = 1; wl[l][w] = -1; } if (cs.size() & 1) next.push_back(cs.back()); std::swap(next, cs); } int f = cs.front(); std::vector cand; for (int i = 1; i <= n; i++) if (wl[f][i] > 0) cand.push_back(i); while (cand.size() > 1) { std::vector next; for (int i = 1; 2 * i - 1 < cand.size(); i++) { next.push_back(ask(cand[2 * i - 2], cand[2 * i - 1])); } if (cand.size() & 1) next.push_back(cand.back()); std::swap(next, cand); } printf("! %d\n", cand.front()); fflush(stdout); return 0; }