cin >> n; int p = ask(1, n); if (p == 1 || ask(1, p) != p) { int l = p + 1, r = n, m; while (l < r) { m = l + r >> 1; if (ask(p, m) == p) r = m; else l = m + 1; } cout << "! " << l << endl; } else { int l = 1, r = p - 1, m; while (l < r) { m = l + r + 1 >> 1; if (ask(m, p) == p) l = m; else r = m - 1; } cout << "! " << l << endl; } return0; }