program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var n,m,i,j,k,l,r,s : LongInt;
a : array [1..32000] of LongInt;
v1,v2 : array [1..5120000] of LongInt;
begin
Read(n);
s:=0;

for i:=1 to n do
Read(a[i]);
m:=a[1];
repeat
m:=a[1];
for i:=1 to n do
If a[i]>m then
begin
m:=a[i];
l:=i;
end;
For j:=l to n-1 do
begin
s:=s+1;
v1[s]:=j;
v2[s]:=j+1;
r:=a[j];
a[j]:=a[j+1];
a[j+1]:=r;
end;
n:=n-1;
until n<0;
If a[1]>a[2] then
begin
s:=s+1;
v1[s]:=1;
v2[s]:=2;
r:=a[1];
a[1]:=a[2];
a[2]:=r;
end;
Writeln(s);
For i:=1 to s do
Writeln(v1[i],' ',v2[i]);
end.
