def II() -> int : return int(input()) n = II() now = [1] for i in range(2,n+1): print("?",now[-1],i) if II(): now = now + [i] continue print("?",i,now[0]) if II(): now = [i] + now continue #二分探索しましょう l = 0 r = len(now)-1 while r-l > 1: mid = l+r//2 print("?",mid,i) if II(): l = mid else: r = mid now = now[:r] + [i] + now[r:] print("!") print(n-1) print(*now)