{$r+}
var i,n:longint;
    a:array[1..50000]of longint;

procedure antiheap(var k:integer);
var i,j:longint;
    t:longint;
begin
 i:=k; j:=i div 2;
 while (j>0)and(a[i]<a[j]) do begin
  t:=a[i]; a[i]:=a[j]; a[j]:=t;
  i:=j; j:=i div 2;
 end;
 inc(k);
 t:=a[1]; a[1]:=a[k]; a[k]:=t;
end;

begin
 assign(input,'heapsort.in'); reset(input);
 assign(output,'heapsort.out'); rewrite(output);
 read(n);
 for i:=1 to n do a[i]:=i;
 i:=1;
 while i<n do
  antiheap(i);
 for i:=1 to n do begin
  if i>1 then write(' ');
  write(a[i]);
 end;
 writeln;
 close(output);
 close(input);
end.