def II() -> int : return int(input()) def MI() -> int : return map(int, input().split()) def TI() -> tuple[int] : return tuple(MI()) def LI() -> list[int] : return list(MI()) 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(): r = mid else: l = mid now = now[:l] + [i] + now[l:] print("!") print(n-1) print(*now)