inf = open("chess.in", "r")
ouf = open("chess.out", "w")

n = int(inf.readline())
a = map(int, inf.readline().split())

ans = []
for x, y in enumerate(a):
    if x <= y - 1:
        ans.append((x + 1, x + 1))
    else:   
        break

print(len(ans), file = ouf)
for x, y in ans:
    print(x, y, file = ouf)
    

inf.close()
ouf.close()

