{$APPTYPE CONSOLE}
 Const MaxN=50005;
  Type St = record
             num : integer;
             realnum : integer;
            End;
 Var mas : Array [1..Maxn] of st;
  N : integer;

 Procedure swap(var a,b : St);
   Var f : st;
  begin
   f:=a;
   a:=b;
   b:=f;
  End;


 Procedure findway(num : Integer);
   Var A : Array [1..1000] of integer;
   i,col,nn : integer;
  Begin
   col:=0;nn:=num;
    while num<>0 do
     Begin
      inc(col);
      a[col]:=num;
      num:=num div 2;
     End;
   for i:=col downto 2 do swap(mas[a[i]],mas[a[i-1]]);
   mas[1].realnum:=nn;
  End;

procedure Solve;
  Var i : Integer;
 Begin
  mas[1].realnum:=n;mas[n].realnum:=1;
  for i:=1 to n do mas[i].num:=i;
  for i:=n-1 downto 2 do
   Begin
    swap(mas[1],mas[i+1]);
    findway(i);
   End;
 End;

procedure outans;
  var i : integer;
  ans : array [1..MaxN] of integer;
 Begin
  for i:=1 to n do
    ans[mas[i].num]:=mas[i].realnum;
  for i:=1 to n do write(ans[i],' ');
 End;

begin
 Assign(input,'heapsort.in');Reset(input);
 Assign(output,'heapsort.out');Rewrite(output);
 read(N);
 Solve;
 Outans;
end.
