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

cnt=0
for i in range(1,n):
    if P[i]==i:
        if P[i-1]!=i:
            cnt +=1
            P[i],P[i-1]=P[i-1],P[i]
        elif P[i+1]!=i:
            cnt +=1
            P[i],P[i+1]=P[i+1],P[i]

print(cnt)