n = int(input()) a = list(map(int, input().split())) ans = [] for i in range(n-1): 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(len(ans)) for i in ans: print(*i) dummy = input()