N=int(input())
P=list(map(int,input().split()))
count=0
g=0
for i in range(N-1):
    if P[i]==i+1:
        if P[i+1]==i+2:
            count+=1
            g+=1
        else:
            count+=1
if P[N-1]==N:
    count+=1
print(count-g)