n = int(input()) a = list(map(int, input().split())) cnt = 0 ans = [] for i in range(n): minv = i for j in range(i+1, n): if a[j] < a[minv]: minv = j cnt += 1 ans.append([i,j]) a[i], a[minv] = a[minv], a[i] print(cnt) for i, j in ans: print(i, j) dummy = int(input())