program taskH;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
gl,A:array[1..500000] of longint;
W,N,I,tt:longint;
Function max(k1,k2:longint):longint;
begin
   max:=k1;
   if k1<k2 then max:=k2;
end;
Function recgl(ll:longint):longint;
var
  tt:longint;
begin
  recgl:=0;
  if ll>n then exit;
  tt:=max(recgl(ll*2),recgl(ll*2+1))+1;
  recgl:=tt;
  gl[ll]:=tt;
end;
Procedure rec(ll:longint);
begin
  if ll>n then exit;
  a[ll]:=tt;
  dec(tt);
  if gl[2*ll]>gl[2*ll+1] then
  begin
    rec(2*ll);
    rec(2*ll+1);
  end else
  begin
    rec(2*ll+1);
    rec(2*ll);
  end;
end;
begin
assign(input,'heapsort.in');reset(input);
assign(output,'heapsort.out');rewrite(output);
read(n);
a[n]:=1;
dec(n);

recgl(1);
tt:=n+1;
rec(1);
for i:=1 to N do write(A[i],' ');
writeln(A[N+1]);
close(output);
end.
