program heap;
var
  n,i,j1,j2: integer;
  a: array[1..50001] of integer;
begin
  assign(input,'heapsort.in');
  reset(input);
  assign(output,'heapsort.out');
  rewrite(output);
  readln(n);
  close(input);
  if n<4 then
  begin
    for i:=n downto 1 do
      write(i,' ');
    close(output);
    exit
  end;
  for i:=1 to 3 do
    a[i]:=4-i;
  for i:=3 to n-1 do
  begin
    j1:=i;
    j2:=i div 2;
    while(j2>=1)do
    begin
      a[j1]:=a[j2];
      j1:=j2;
      j2:=j2 div 2
    end;
    a[j1]:=i+1;
    a[i+1]:=1
  end;
  for i:=1 to n do
    write(a[i],' ');
  close(output);
end.
