n = int(input())
a = list(map(int,input().split(' ')))
ans = 0
tmp = 0
for i in range(n):
    if i+1 == a[i]:
        tmp += 0.5
    elif tmp:
        ans += tmp//2 + 1
        tmp = 0
if tmp:
    ans += tmp//2 + 1
print(int(ans))
