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