const
	maxN = 50000;

var
	N:	Integer;
  x:	array[1..maxN] of Integer;

Procedure Init;
Begin
	read(N);
End;

Procedure Solve;
var
	i:		Integer;
  p,last:Integer;
  done: Boolean;
  t: Integer;
Begin
	x[1] := 1;
  for i := 2 to N do begin
  	x[i] := 1; x[i-1] := i;
    p := i-1; last := p shr 1;
    done := False;
    while (last>=1)and(not done) do
    	if x[last]<x[p] then begin
      	t := x[p]; x[p] := x[last]; x[last] := t;
        p := last; last := p shr 1;
      end
      else done := True;
  end
End;

Procedure Save;
var
	i:	Integer;
Begin
	for i := 1 to N do write(x[i], ' ');
End;

begin
assign(input,'heapsort.in'); reset(input);
assign(output,'heapsort.out'); rewrite(output);
  Init;
  Solve;
  Save;
close(input);
close(output);
end.
 