def Question(x): print(f'? {x}') return int(input()) def Answer(x): print(f'! {x}') exit() N = int(input()) S = [] for i in range(2,N+1): flg = True for k in S: if i % k == 0: flg = False break if flg: S.append(i) P = [1] * (N+1) for i in S: if Question(i) >= 2: for j in range(2,N+1): if j % i != 0: P[j] = 0 else: for j in range(i,N+1,i): P[j] = 0 for i in range(N,-1,-1): if P[i]: Answer(i)