{$apptype console}

type
  TArray = array[1..50000] of integer;

procedure unshift(var a: TArray; len: integer);
var
  l: integer;
begin
  l := a[len];

  while len div 2 > 0 do begin
    a[len] := a[len div 2];
    len := len div 2;
  end;

  a[1] := l;
end;

var
  a: TArray;
  i, n: integer;

begin
  Assign(input, 'heapsort.in');
  Assign(output, 'heapsort.out');
  Reset(input);
  Rewrite(output);

  Read(n);
  a[1] := 1;

  for i := 2 to n do begin
    unshift(a, i - 1);
    a[i] := a[1];
    a[1] := i;
  end;

  Write(a[1]);
  for i := 2 to n do Write(' ', a[i]);

  Close(input);
  Close(output);
end.