def merge_sort(A,cmp): def merge(L,M,R): B = A[L:R] j1 = 0 j2 = l1 = M-L l2 = R-L while j1 < l1 or j2 < l2: if j2 == l2 or (j1 < l1 and cmp(B[j1],B[j2]) <= 0): A[L] = B[j1] j1 += 1 else: A[L] = B[j2] j2 += 1 L += 1 n = len(A) step = 1 while step < n: L = 0 M = step R = step = step*2 while M < n: if R >= n: R = n merge(L,M,R) L = R M += step R += step def cmp(s,t): return -1 if query(s,t) == 1 else 1 def query(x,y): print(f"? {x} {y}", flush=1) if DEBUG: return 1 else: return int(input()) import sys readline = sys.stdin.readline DEBUG = 0 n = int(readline()) a = list(range(1,n+1)) merge_sort(a,cmp) print("!",flush=1) print(n-1,flush=1) print(*a,flush=1)