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:
        ans += 1
    i += 1
print(ans)
