from math import gcd n=int(input()) a=1 while a1:break print("?",a) r=int(input()) if r%2==1:continue t=pow(a,r//2,n) g=gcd(n,t-1) if g>1 and g1 and g