n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    a[i]-=1
ans=0
for i in range(n-1):
    if a[i]==i and a[i+1]==i+1:
        continue
    if a[i]==i:
        ans+=1
if a[-1]==n-1:
    ans+=1
print(ans)