{$A+,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

var qc,p:array[0..100000]of longint;
    i,j,k,n,cur:longint;
    ass:boolean;

{procedure rec(i:longint);
        begin
        if cur>n then exit;
        qc[i]:=n-cur+1;
        inc(cur);
        if 2*i<=n then rec(2*i);
        if 2*i+1<=n then rec(2*i+1);
        end;
}
begin
assign(input,'heapsort.in');
assign(output,'heapsort.out');
reset(input);
rewrite(output);
readln(n);
j:=0;
p[0]:=1;
for i:=1 to 21 do p[i]:=p[i-1]*2;
cur:=0;
while cur<=n do
        begin
        inc(j);
        i:=1;
        if j>1 then
                while qc[i]<>0 do inc(i);
        k:=p[j-1];
        ass:=false;
        while not(ass) do
                begin
                inc(cur);
                qc[i]:=cur;
                i:=i+k;
                k:=k*2;
                if i>n then ass:=true;
                end;
        end;
for i:=1 to n do write(n-qc[i]+1,' ');
close(input);
close(output);
end.