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

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