{$apptype console}
{ $q+,r+,o-}
{$q+,r+,o+}
{ $q-,r-,o+}

uses
  math, sysutils;

type
  int = longint;
  bool = boolean;
  float = extended;

const
  fn = 'heapsort';
  maxh = 50005;

var
  h: array[1..maxh] of integer;
  n, curmax: integer;

procedure solve;
var
  mc, cur, cc, i: integer;
begin
  fillchar( h, sizeof( h ), 0 );
  read( n );
  h[1] := n;
  h[n] := 1;
  curmax := n - 1;
  for i := n - 1 downto 1 do
    if ( h[i] = 0 ) then begin
      mc := 0;
      cur := i;
      while true do begin
        inc( mc );
        cur := cur div 2;
        if ( h[cur] <> 0 ) then break;
      end;

      cc := 0;
      cur := i;
      while true do begin
        h[cur] := curmax - mc + cc + 1;
        inc( cc );
        cur := cur div 2;
        if ( h[cur] <> 0 ) then break;
      end;
      dec( curmax, mc );
    end;

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

begin
  reset(input, fn + '.in');
  rewrite(output, fn + '.out');

  solve;
end.
