import random
LOCAL=1
ans=[]
N=0
cnt=0
def ask(p):
global cnt
cnt+=1
if LOCAL:
for i in p:
assert 1<=i<=N
same=0
for i in range(N):
if p[i]==ans[i]:
same+=1
return same
else:
print(0,*ans,flush=True)
same=int(input())
return same
def answer(p):
if LOCAL:
assert ans==p
print("cnt",cnt)
else:
print(1,*p,flush=True)
return
def solve():
print(N)
if N==1:
answer([1])
return
if N==2:
s=ask([1,2])
if s==2:
answer([1,2])
else:
answer([2,1])
return
dummy=-1
s2=ask([1]*(N-1)+[2])
for i in range(3,N+1):
if dummy!=-1:
continue
si=ask([1]*(N-1)+[i])
if si!=s2:
if s2>si:
dummy=2
else:
dummy=i
if dummy==-1:
dummy=1
tmp=[-1]*N
tmp[N-1]=dummy
cand=[]
for i in range(1,N+1):
if i!=dummy:
cand.append(i)
random.shuffle(cand)
def calc(l,r,rem):
if len(rem)==1:
tmp[l]=rem[0]
return
nL=[]
nR=[]
mid=(l+r)//2
todo=[]
while len(rem)>1:
todo.append(rem.pop())
todo.append(rem.pop())
sz=len(todo)
edge=[[] for i in range(sz)]
dic={}
for i in range(sz):
dic[todo[i]]=i
Q=todo.copy()
added=[-1]*sz
bfs=[]
while todo:
ntodo=[]
while len(todo)>=2:
x=todo.pop()
y=todo.pop()
p=[dummy]*N
for i in range(l,mid):
p[i]=x
for i in range(mid,r):
p[i]=y
s=ask(p)-1
if s==0:
nL.append(y)
nR.append(x)
added[dic[x]]=1
added[dic[y]]=0
bfs.append(dic[x])
bfs.append(dic[y])
if s==2:
nR.append(y)
nL.append(x)
added[dic[x]]=0
added[dic[y]]=1
bfs.append(dic[x])
bfs.append(dic[y])
else:
edge[dic[x]].append(dic[y])
edge[dic[y]].append(dic[x])
ntodo.append(x)
if len(todo)==1:
x=todo.pop()
p=[dummy]*N
for i in range(l,mid):
p[i]=x
s=ask(p)-1
if s==0:
added[dic[x]]=0
else:
added[dic[x]]=1
bfs.append(dic[x])
todo=ntodo
while bfs:
v=bfs.pop()
if added[v]==0:
nL.append(Q[v])
else:
nR.append(Q[v])
for u in edge[v]:
if added[u]==-1:
added[u]=added[v]^1
bfs.append(u)
if len(rem)==1:
val=rem.pop()
if mid-l!=len(nL):
nL.append(val)
else:
nR.append(val)
calc(l,mid,nL)
calc(mid,r,nR)
calc(0,N-1,cand)
answer(tmp)
while True:
if LOCAL:
N=1000
ans=list(range(1,N+1))
random.shuffle(ans)
else:
N=int(input())
solve()
if LOCAL==0:
exit()
cnt=0