program probH;

{$APPTYPE CONSOLE}

const maxn = 50000;
procedure swap(var a, b : longint);
var c : longint;
begin
  c:=a;
  a:=b;
  b:=c;
end;
var
   pt : array[1..maxn]of longint;
   n,i,j,k:longint;
begin
   assign(input,'heapsort.in');
   reset(input);
   assign(output,'heapsort.out');
   rewrite(output);
   read(n);
   for i:=1 to n do pt[i]:=i;

   swap(pt[1], pt[n]);

   for i := 2 to n div 2 do begin
      if pt[i]<pt[2*i] then swap(pt[i],pt[2*i]);
      if 2*i+1<=n then
       if pt[i]<pt[2*i+1] then swap(pt[i],pt[2*i+1]);
   end;
   for i:=1 to n do write(pt[i],' ');
   writeln;

   close(input);
   close(output);
end.
