N=int(input())
P=[1]+list(map(int,input().split()))

ans=0
for i in range(1,N):
    if P[i]==i:
        if P[i-1]!=i:
            P[i-1],P[i]=P[i],P[i-1]
        else:
            P[i+1],P[i]=P[i],P[i+1]
        ans+=1
print(ans)