n=16
hv=[0]*16
m=int(input())
def main():
hx(1)
def hx(u):
if u > m:
x=-1
for xh in hv:
x+=1
if xh == 1:
print(x,end=' ')
print()
return
hv[u]=2
hx(u+1)
hv[u]=0
hv[u]=1
hx(u+1)
hv[u]=0
main()