from bisect import bisect_left N = int(input()) A = list(map(int, input().split())) ans = [] for i in range(N): for j in range(i + 1, N): if A[i] > A[j]: ans.append((i, j)) A[i], A[j] = A[j], A[i] #print(A) print(len(ans), flush=True) for i in range(len(ans)): print(ans[i][0], ans[i][1], flush=True) Dummy = int(input())