#include int main() { int n; scanf("%d", &n); std::vector x; for (int i = 0; i < n; i++) x.push_back(i); std::vector > log; while (x.size() > 1) { std::vector next; for (int i = 0; i < x.size() / 2; i++) { log.push_back({x[2 * i], x[2 * i + 1]}); printf("? %d %d\n", log.back().first + 1, log.back().second + 1); fflush(stdout); int cur; scanf("%d", &cur); next.push_back(cur - 1); } if (x.size() % 2) next.push_back(x.back()); x.swap(next); } std::vector y; for (auto &i : log) { if (i.first == x[0]) y.push_back(i.second); if (i.second == x[0]) y.push_back(i.first); } while (y.size() > 1) { std::vector next; for (int i = 0; i < y.size() / 2; i++) { printf("? %d %d\n", y[2 * i] + 1, y[2 * i + 1] + 1); fflush(stdout); int cur; scanf("%d", &cur); next.push_back(cur - 1); } if (y.size() % 2) next.push_back(y.back()); y.swap(next); } printf("! %d\n", y[0] + 1); return 0; }