1 /**\
2 https://codeforces.com/contest/1480/problem/C
3 二分不断维护一个区间
4 使得a[l - 1] > a[l], a[r] < a[r + 1]
5 \**/
6 #include <bits/stdc++.h>
7 using namespace std;
8
9 const int N = 1e5 + 10;
10 int n, a[N];
11
12 void accept()
13 {
14 cin >> n;
15
16 int l = 1, r = n;
17
18 while(l < r)
19 {
20 int mid = (l + r) >> 1;
21 cout << "? " << mid << "\n";
22 fflush(stdout);
23 cout << "? " << mid + 1 << "\n";
24 fflush(stdout);
25 cin >> a[mid] >> a[mid + 1];
26
27 if(a[mid] < a[mid + 1]) r = mid;
28 else l = mid + 1;
29 }
30
31 cout << "! " << l << "\n";
32 }
33 signed main()
34 {
35 accept();
36 return 0;
37 }