N=int(input()) A=list(map(int,input().split())) ANS=[] for i in range(N): MIN=min(A[i:]) if MIN==A[i]: continue else: for j in range(i,N): if A[j]==MIN: ANS.append((i,j)) A[i],A[j]=A[j],A[i] break print(len(ANS),flush=True) for x,y in ANS: print(x,y,flush=True) D=input()