N = int(input())
P = list(map(int, input().split()))
Q = {}
for i in range(N):
    Q[i + 1] = P[i]

ans = 0
for i in range(1, N - 1):
    if Q[i] == i:
        Q[i], Q[i + 1] = Q[i + 1], Q[i]
        ans += 1
if Q[N] == N:
    ans += 1
print(ans)
