{$apptype console}
const
 fin='heapsort.in';
 fout='heapsort.out';
var
  A,Ans,Path:array[1..50000] of longint;

  N,i,p,j,buf:longint;

begin
 assign(Input,fin); reset(input);
 assign(Output,fout); rewrite(output);
 readln(n);
 for i:=1 to n do A[i]:=i;
 p:=0;
 Ans[1]:=1;

 for i:=n-1 downto 1 do
   begin
     j:=i;
     p:=0;
     while true do
       begin
         inc(p);
         path[p]:=j;
         j:=j div 2;
         if j=0 then break;
       end;
     for j:=p downto 2 do
       begin
         buf:=a[path[j]];
         a[path[j]]:=a[path[j-1]];
         a[path[j-1]]:=buf;
       end;
    Ans[n-i+1]:=A[1];   
   end;
  Ans[n]:=n; 
  for i:=1 to n do
    A[Ans[i]]:=n-i+1;
  for i:=1 to n do
    write(A[i],' ');
 close(input); close(output);
end.