n = int(input())
p = [int(i) for i in input().split()]
ls = [0] * n
for i in range(n):
    if p[i] == i+1:
        ls[i] = 1
ans = 0
for i in range(n-1):
    if ls[i] == 1:
        ans += 1
        ls[i] = 0
        ls[i+1] = 0
        tmp = p[i]
        p[i] = p[i+1]
        p[i+1] = tmp
print(ans)
