N = int(input())
p = [int(x) for x in input().split(' ')]

num = 0
res = 0
for i in range(N):
    if p[i] == i + 1:
        num += 1
    else:
        res += (num + 1) // 2
        num = 0

print(res)
