N = int(input())
p=list(map(int, input().split()))
p_=[i for i in range(1,N+1)]
#前と後ろどっちと交換すればよいか
ans=0
for i in range(N):
    if p[i]==i+1:
        if i<N-1 and p[i+1]==i+2:
            a=p[i]
            b=p[i+1]
            p[i]=b
            p[i+1]=a
            ans+=1
        else:
            a=p[i]
            b=p[i-1]
            p[i]=b
            p[i+1]=a
            ans+=1
print(ans)


