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

    read(n);

    fillchar(a, sizeof(a), 0);
    a[n] := 1;
    l := n;
    for i := n - 1 downto 1 do
        begin
        k := i;
        while k > 0 do begin
            if a[k] = 0 then
                dec(l);
            k := k shr 1;
        end;
        ll := l + 1;
        k := i;
        while k > 0 do begin
            if a[k] = 0 then begin
                a[k] := ll;
                inc(ll);
            end;
            k := k shr 1;
        end;
    end;
    k := n;
    l := 0;
    while (k + 1) and k > 0 do begin
        inc(l);
        k := k shr 1;
    end;
    if a[k * 2 + 1] > 0 then begin
//        writeln(k, ' ', l);
        i := k;
        while a[i * 2] > 0 do
            i := i shl 1;
//        writeln('REVERSE ', a[k * 2 + 1], ' & ', a[i + l - 2]);
        if a[i + l - 2] > 1 then begin
            ll := a[k * 2 + 1];
            a[k * 2 + 1] := a[i + l - 2];
            a[i + l - 2] := ll;
        end;
    end;
    for i := 1 to n do
        write(a[i], ' ');
end.