{$apptype console}

program heapsort;

const
                infile='heapsort.in';
                outfile='heapsort.out';
                maxn=50001;

type
                int=longint;

var
        a               :array [1..maxn] of int;
        n,k             :int;

procedure load;
var
        i:int;
begin
  assign(input,infile);
  reset(input);
  read(n);
  close(input);
end;

procedure swap(var a,b:int);
var
        c:int;
begin
  c:=a;
  a:=b;
  b:=c;
end;

procedure solve;
var
        i,j:int;
begin
  a[1]:=1;
  k:=1;
  for i:=2 to n do begin
    j:=k;
    while j<>1 do begin
      swap(a[j],a[j div 2]);
      j:=j div 2;
     end;
    inc(k);
    a[k]:=i;
    swap(a[k],a[1]);
   end;
end;

procedure print;
var
        i:int;
begin
  assign(output,outfile);
  rewrite(output);
  for i:=1 to n do write(a[i],' ');
  close(output);
end;

begin
  load;
  solve;
  print;
end.
