n = int(input())
p = list(map(int, input().split()))

i=0
ans=0
while i<n-1:
    if p[i] == i+1 and p[i+1] == i+2:
        i+=1
        ans+=1
    elif p[i] == i+1 and p[i+1] != i+2:
        ans+=1
    i+=1
if p[n-1] == n and p[n-2]!=n-1:
    ans+=1
print(ans)