N = int(input()) import sys now = 1 dat = [0] * (N + 1) while True: for i in range(2,N // now + 1): if now * i > N: print("!",now) exit() if dat[now * i] == 1:continue print("?",now*i) s = int(input()) if s == now * i: now = now * i break else: for j in range(now*i,N+1,now*i): dat[j] = 1