i,j,s,t,a[110],b[20000]; main(n){ for(scanf("%d",&n);~scanf("%d",a+i);i++); a[i-1]=0; for(;n--;)for(j=1;a[j];j++)if(a[j-1]>a[j]){ b[s++]=j-1; b[s++]=j; a[j-1]^=a[j]^=a[j-1]^=a[j]; } printf("%d\n",s/2); for(i=0;b[i];i+=2)printf("%d %d\n",b[i],b[i+1]); fflush(0); return 0; }