n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
reverses=[]
for i in range(n):
    mx=max(a)
    if mx!=a[-1]:
        nd=a.index(mx)
        a=a[:nd]+list(reversed(a[nd:]))
        reverses.append([nd+1,len(a)])
    del a[-1]
print(len(reverses))
for r in reverses:
    print(*r)
