{$o-,q+,r+}
{ $o+,q-,r-}
{$MINSTACKSIZE $00004000}
{$APPTYPE console}
uses
    sysutils;
type
    int = longint;
const
    finname = 'heapsort';
    maxn = 100010;
var
    n, i, k, fp, fa: int;
    a, p, ans: array[1 .. maxn] of int;
begin
    reset(input, finname + '.in');
    rewrite(output, finname + '.out');

    read(n);

    fillchar(a, sizeof(a), 0);
    for i := 1 to n do
        p[i] := i;
    a[n] := 1;
    a[1] := n;
    for i := n - 1 downto 1 do begin
        fp := p[1];
        fa := a[1];
        k := i;
        while k > 1 do begin
            a[k shr 1] := a[k];
            p[k shr 1] := p[k];
            k := k shr 1;
        end;
        a[i] := fa;
        p[i] := fp;
        a[1] := i;
    end;

    for i := 1 to n do
        ans[p[i]] := a[i];

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