var i,n,j,k,r:longint;
    mas:array[1..50000] of longint;
begin
  assign(input,'heapsort.in');
  reset(input);
  assign(output,'heapsort.out');
  rewrite(output);
  read(n);
  for i:=1 to n do
    mas[i]:=i;
  for i:=2 to n-1 do
    begin
      k:=mas[1];
      mas[1]:=mas[i];
      mas[i]:=k;
      j:=i;
      while j>1 do
        begin
          r:=j div 2;
          k:=mas[r];
          mas[r]:=mas[j];
          mas[j]:=k;
          j:=r;
        end;
    end;
  k:=mas[1];
  mas[1]:=mas[n];
  mas[n]:=k;
  for i:=1 to n do
    write(mas[i],' ');
  close(input);
  close(output);
end.
 