N=int(input())
P=input()
P=P.rstrip().split()
P.append('0')

ans=0
l=0
for i in range(N+1):
    if l>=N-1:
            break
    elif P[l]==str(l+1):
        ans+=1
        l+=2
    else:
        l+=1
        
print(ans)