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