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

ans = 0
next = False
for i in range(N):
    if p[i] == i+1:
        ans += 1
        if i+1 < N and p[i+1] == i+2:
            next = True
        if next:
            ans -= 1
            next = False

print(ans)