{$apptype console}

var
  n, i: integer;
  v: array[1..50005] of integer;

procedure swap(i, j: integer);
var
  t: integer;
begin
  t := v[i];
  v[i] := v[j];
  v[j] := t;
end;

procedure siftup(i: integer);
var
  p: integer;
begin
  p := i shr 1;
  while (p > 0) and (v[p] > v[i]) do begin
    swap(i, p);
    i := p;
    p := i shr 1;
  end;
end;

begin
  assign(input, 'heapsort.in'); reset(input);
  assign(output, 'heapsort.out'); rewrite(output);

  read(n);

  for i := 1 to n do begin
    v[i] := i;
    swap(1, i);
    if i < n then
      siftup(i);
  end;

  for i := 1 to n do
    write(v[i], ' ');

  writeln;
end.
