n = int(input()) a = [0] * n for i in range(n): a[i] = i + 1 def merge_sort(v): if len(v) == 1: return v c = merge_sort(v[:len(v) // 2]) d = merge_sort(v[len(v) // 2:]) i, j = 0, 0 res = [] while i < len(c) and j < len(d): print("?", c[i], d[j]) t = int(input()) assert t != -1 if t: res.append(c[i]) i += 1 else: res.append(d[j]) j += 1 while i < len(c): res.append(c[i]) i += 1 while j < len(d): res.append(d[j]) j += 1 return res merge_sort(a) print("!", n - 1, sep = "\n") print(*a)