#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #define _GLIBCXX_DEBUG #else #define Debug(...) void(0) #endif using ll = long long; #define rep(i, n) for (int i = 0; i < (n); ++i) int Query(int x, int y) { printf("? %d %d\n", x, y); fflush(stdout); int z; cin >> z; return z; } int main() { int n; cin >> n; vector a(n, false); int cnt = 0; rep(i, n) { if (a[i]) continue; int z = i; if (cnt != n - 1) z = Query(i, i); if (z == i) { printf("! %d\n", i); fflush(stdout); return 0; } a[i] = a[z] = true; cnt += 2; } return 0; }