program saskes;

  const MAX = 20;
  type lentele = array [1..MAX] of integer;

  procedure kilnoti (n: integer; lan: lentele);
    { žažki— kr–vel‚s rikiuojamos Burbulo algoritmu }
    var f: text;
        i, j, did, tarp: integer;
        sukeista: boolean;
  begin
    assign (f, 'SASK.REZ');
    rewrite (f);
    sukeista := false;
    i := 1;
    while (i < n) do
      begin
        { randame did‘iausi… element… }
        did := i;
        for j := i+1 to n do
          if lan[did] < lan[j]
             then did := j;
        if did <> i
           then begin { sukei‡iame }
                  tarp := lan[i]; lan[i] := lan[did]; lan[did] := tarp;
                  writeln (f, i, ' ', did);
                  sukeista := true;
                end;
        i := i + 1;
      end;
    if not sukeista then writeln (f, 0);
    close (f);
  end; { kilnoti }

  procedure skaityti (var n: integer; var lan: lentele);
    var f: text;
        i: integer;
  begin
    assign (f, 'SASK.DAT');
    reset (f);
    readln (f, n);
    for i := 1 to n do
      read (f, lan[i]);
  end; { skaityti }

  var n: integer;
      lan: lentele;
begin
  skaityti (n, lan);
  kilnoti (n, lan);
end.