N=int(input())
p=list(map(int,input().split()))
ans=0
for i in range(0,N-2,2):#2個ペアで見ていく
    if p[i]==i+1 and p[i+1]==i+2:
        ans+=1
        #print(p[i])
    elif p[i]==i+1 or p[i+1]==i+2:
        ans+=1
        #print(p[i])
if N%2==1:
    if p[-1]==N:
        ans+=1
print(ans)