n=int(input())
p=list(map(int,input().split()))
ans=0
cnt=0
for i in range(n):
    if p[i]==i+1:
        cnt+=1
        if cnt==2:
            ans+=1
            cnt=0
    elif cnt==1:
        ans+=1
        cnt=0
print(ans)