import sys from collections import deque, Counter input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) inf = 2 ** 63 - 1 mod = 998244353 def query(x, y): print('?', x, y, flush=True) return ii() def answer(z): print('!', z, flush=True) exit() n = ii() s = set(range(n)) pos = {} for i in range(n): if i not in s: continue s.discard(i) z = query(i, i) if z == i: answer(z) if z in pos and n % 2 == 0: answer(pos[z]) s.discard(z) if len(s) == 1: answer(s.pop()) pos[i] = z