from random import shuffle N = int(input()) P = list(range(1,N+1)) shuffle(P) RP = [-1]*N for i in range(N): RP[P[i]-1] = i def ask(a,b): print("?",P[a],P[b]) T = int(input()) return T == 1 if ask(0,1): now = [0,1] else: now = [1,0] for i in range(2,N): if ask(i,now[0]): now.insert(0,i) elif ask(now[-1],i): now.append(i) else: for j in range(1,len(now)-1): if ask(i,now[j]): now.insert(j,i) break else: now.insert(len(now)-1,i) print("!") print(len(now)-1) print(*list(map(lambda x:P[x],now)))