program warsort;

const
    maxn = 100;

var
    a: array [1..maxn] of integer;
    i, j, k, l, n: integer;

procedure swap(i, j: integer);
var
    t: integer;
begin
    writeln(i, ' ', j);
    t := a[i]; a[i] := a[j]; a[j] := t;

{    for t := 1 to n do
        write(' ', a[t]);
    writeln;}
end;

begin
{    assign(input, 'sort.in');
    reset(input);
    assign(output, 'sort.out');
    rewrite(output);}

    read(n);
    for i := 1 to n do 
        read(a[i]);

    for i := 1 to n do
    begin
        if a[i] = i then continue;

        k := 0;
        for j := i + 1 to n do
            if a[j] = i then
            begin
                k := j;
                break;
            end;

        while k > i do
        begin
            if a[k - 1] <> k then
            begin
                swap(k - 1, k);
                dec(k);
            end else begin
                l := k - 1;
                while (l >= i) and (a[l] = l + 1) do
                begin
                    dec(l);
                end;

                if l < i then
                begin
                    for j := k - 1 downto i do
                    begin
                        swap(j, j + 1);
                    end;
                    k := i;
                end else begin
                    for j := l to k - 2 do
                    begin
                        swap(j, j + 1);
                    end;
                    for j := k - 1 downto l do
                    begin
                        swap(j, j + 1);
                    end;
                    k := l;
                end;
            end;
        end;
    end;

    close(input);
    close(output);
end.
