import sys from random import * N=int(input()) P=list(range(N)) shuffle(P) def query(a,b): print('?',P[a]+1,P[b]+1) sys.stdout.flush() return int(input()) def answer(C): print('!') print(len(C)-1) print(*[P[C[i]]+1 for i in range(len(C))]) sys.stdout.flush() exit() def f(X): if len(X)<=1: return X v=X[0] a=[] b=[] for i in range(1,len(X)): if query(v,X[i]): b.append(X[i]) else: a.append(X[i]) p,q=f(a),f(b) return p+[v]+q answer(f(list(range(N))))