program h;

{$APPTYPE CONSOLE}
{.$R+}

var
  N: Integer;

procedure Inp;
begin
  Read(N);
end;

var
  P: array[1..50000] of Integer;
  A: array[1..50000] of Integer;

procedure Swap(var A, B: Integer);
var
  T: Integer;
begin
  T:=A;
  A:=B;
  B:=T;
end;

procedure Run;
var
  I, J: Integer;
  Path:array[1..1000] of Integer;
  NP: Integer;
begin
  for I:=1 to N do
    P[I]:=I;
  for I:=N-1 downto 1 do
    begin
      Swap(P[1], P[I+1]);

      J:=I;
      NP:=0;
      while (J <> 0) do
        begin
          Inc(NP);
          Path[NP]:=J;
          J:=J div 2;
        end;

      for J:=NP-1 downto 1 do
        Swap(P[Path[J]], P[Path[J+1]]);
    end;
  for I:=1 to N do
    A[P[I]]:=I;

  for I:=1 to N do
    Write(A[I], ' ');
end;

begin
  Assign(Input, 'heapsort.in');
  Reset(Input);
  Assign(Output, 'heapsort.out');
  ReWrite(Output);

  Inp;
  Run;
end.
