import math
import sys
N=int(input())
p=list(map(int,input().split()))
cnt=0
if p[0] == 1:
    cnt += 1
for i in range(1,N):
    if p[i]==i+1 and p[i-1]!=i:
        cnt+=1
        print(p[i],i+1)
print(cnt)
