import random import math DEBUG = 0 class BIT: def __init__(self, n): self.n = n self.data = [0] * (n + 1) if n == 0: self.n0 = 0 else: self.n0 = 1 << (n.bit_length() - 1) def sum_(self, i): s = 0 while i > 0: s += self.data[i] i -= i & -i return s def sum(self, l, r=-1): if r == -1: return self.sum_(l) else: return self.sum_(r) - self.sum_(l) def get(self, i): return self.sum(i, i + 1) def add(self, i, x): i += 1 while i <= self.n: self.data[i] += x i += i & -i def lower_bound(self, x): if x <= 0: return 0 i = 0 k = self.n0 while k > 0: if i + k <= self.n and self.data[i + k] < x: x -= self.data[i + k] i += k k //= 2 return i + 1 n = int(input()) if DEBUG: ans = [i for i in range(1, n + 1)] random.shuffle(ans) qc = 0 n += 1 L = [0] * n R = [0] * n R[-1] = 1 def f(): X = [(l + r) for l, r in zip(L, R)] for i in range(n - 1): if X[i] > i: X[i] -= i + 1 X[i + 1] += 1 for i in range(n - 1, 0, -1): if X[i] % 2 == 1: X[i - 1] += i X[i] //= 2 X[0] //= 2 return X memo = {} def ask(X, q="?"): if q == "?" and tuple(X) in memo: return memo[tuple(X)] P = [] bit = BIT(n) for i in range(n): bit.add(i, 1) for x in X[::-1]: p = bit.lower_bound(x + 1) - 1 P.append(p) bit.add(p, -1) P = P[1:] print(q, *P, flush=True) if DEBUG: global qc if q == "!": assert ans == P, (ans, P) ma = math.floor(math.floor((n - 1) * math.log2(n)) - (n - 1) / 2 + 1) print(qc, ma) return qc += 1 for i in range(n - 1): if P[i] < ans[i]: memo[tuple(X)] = 1 return 1 elif P[i] > ans[i]: memo[tuple(X)] = 0 return 0 memo[tuple(X)] = 1 return 1 if len(set(P)) != n - 1: return -1 if q == "?": res = int(input()) memo[tuple(X)] = res return res while 1: mid = f() if mid == L: break res = ask(mid) if res == -1: exit() if res == 0: R = mid else: L = mid res = ask(R) if res == -1: exit() if res == 1: ask(R, "!") else: ask(L, "!")