a[110],s,j,k,b[5000]; main(i){ for(;~scanf("%d",a-i);i--); for(a[~i]=0;++i;)for(j=0;a[++j];)a[j-1]>a[j]?b[s++]=j,a[j]^=a[j-1]^=a[j]^=a[j-1]:0; printf("%d\n",s); for(;s=b[k];)fflush(!printf("%d %d\n",b[k++]-1,b[k])); }