from collections import deque n = int(input()) a_list = [i for i in range(n)] d = deque(a_list) a=d.popleft() b=d.popleft() print('?',a,b) i = 0 while i < 10**5: x = int(input()) try: if x == a or x == b: if x == a: print('!',b) else: print('!',a) else: a = d.popleft() b = d.popleft() print('?',a,b) i+=1 except: print('!',n-1) break