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