{$APPTYPE CONSOLE}
var
 n, i: integer;
 a: array[1..50000]of integer;

procedure swap(x, y: integer);
begin
  a[x] := a[x]+a[y]; a[y] := a[x]-a[y]; a[x] := a[x]-a[y];
end;

procedure siftup(x: integer);
begin
  if x>1 then begin
    swap(x, x div 2);
    siftup(x div 2);
  end;
end;

begin
  assign(input, 'heapsort.in'); reset(input);
  assign(output, 'heapsort.out'); rewrite(output);
  read(n);
  a[1] := 1;
  for i:=2 to n do begin
    a[i] := i;
    siftup(i-1);
    swap(1, i);
  end;
  for i:=1 to n-1 do write(a[i], ' '); write(a[n]);
end.
 