f(n,c){printf("%d ",n^!(n/2-1));c>1&&f(n-c,c/=2)+f(n+c,c);}k;main(){f(k,k=1<<~-atoi(gets(&k)));}