program heapsort;
const
 maxn=50002;
type
  tmas=array[1..maxn] of longint;
var
 n,i,j:longint;
 a:tmas;

procedure swap(var x,y:longint);
var
 t:longint;
begin
  t:=x;
  x:=y;
  y:=t;
end;

function min(x,y:longint):longint;
begin
  if x<y then min:=x else min:=y;
end;

begin
  assign(input,'heapsort.in');
  reset(input);
  assign(output,'heapsort.out');
  rewrite(output);
  readln(n);
  fillchar(a,sizeof(a),0);
  a[1]:=1;
  for i:=2 to n-1 do
  begin
    a[i]:=i;
    swap(a[1],a[i]);
    j:=i;
    while j<>1 do
    begin
      swap(a[j],a[j div 2]);
      j:=j div 2;
    end;
{    if i mod 2=0 then j:=i else j:=i-1;
    while j>1 do
    begin
      if a[j+1]<>0 then
      begin
        if a[j]<a[j+1] then swap(a[j],a[j div 2]) else swap(a[j+1],a[j div 2]);
      end else swap(a[j],a[j div 2]);
      dec(j,2);
    end;}
  end;
  a[n]:=n;
  swap(a[1],a[n]);



  for i:=1 to n do write(a[i],' ' );
  close(input);
  close(output);
end.
