program h;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  i,n,p,k: integer;
  a: array[1..100000] of integer;

begin
  AssignFile(Input,'heapsort.in');Reset(Input);
  Read(n);
  CloseFile(Input);
  for i := 1 to n do a[i] := i;
  for i := 2 to n-1 do
  begin
    p := a[1];
    a[1] := a[i];
    a[i] := p;
    k := i;
    while a[1] <> 1 do
    begin
      p := a[k];
      a[k] := a[k div 2];
      a[k div 2] := p;
      k := k div 2;
    end;
  end;
  p := a[1];
  a[1] := a[n];
  a[n] := p;

  AssignFile(Output,'heapsort.out');Rewrite(Output);
  Write(a[1]);
  for i := 2 to n do write(' ',a[i]);

  CloseFile(Output);

end.
