{$MAXSTACKSIZE $10100000}
{$APPTYPE CONSOLE}
{$O-,R+,Q+}

uses
  Sysutils, Math;
const
  inf = 1000000000;
  eps = 1e-9;
  base = 10;
type
  int = longint;
  bool = boolean;
  real = extended;
var
  i, j, k, n, m: int;
  heap: array[1..50000] of int;
  
procedure buildheap(k: int);
var
  i, ii, t: longint;
begin
  if k = 1 then
  begin
    heap[1] := 1;
    exit;
  end;
  buildheap(k - 1);
  t := heap[k - 1];
  i := k - 1;
  while i > 1 do
  begin
    ii := i div 2;
    heap[i] := heap[ii];
    i := ii;
  end;
  heap[k] := t;
  heap[1] := k;
end;

begin
  assign(input, 'heapsort.in');
  reset(input);
  assign(output, 'heapsort.out');
  rewrite(output);
  read(n);
  buildheap(n);
  for i := 1 to n do
  begin
    write(heap[i]);
    if i < n then
      write(' ');
  end;
  close(input);
  close(output);
end.
//Leafy tops of root vegetables strike back...