{$APPTYPE CONSOLE}


{$R+,Q+,S+}
const
    _fin='heapsort.in';
    _fout='heapsort.out';
    maxn=50001;

var
    hp:array [1..MAXN] of longint;
    i,n:longint;

procedure antiheap(k:longint);
var t,i:longint;
begin
    i:=k;
    while (i>1)and((i shr 1)>0)and(hp[i shr 1]>hp[i]) do
    begin
        t:=hp[i];
        hp[i]:=hp[i shr 1];
        hp[i shr 1]:=t;
        i:=i shr 1;
    end;
    t:=hp[1];
    hp[1]:=hp[k+1];
    hp[k+1]:=t;
end;
begin
    assign(input,_fin);reset(input);
    read(n);
    close(input);
    for i:=1 to n do
        hp[i]:=i;
    for i:=2 to n do
        antiheap(i-1);
    assign(output,_fout);rewrite(output);
    write(hp[1]);
    for i:=2 to n do
        write(' ',hp[i]);

    close(output);
end.