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

ans = 0
# print(P)

for i in range(N):
    if P[i] != int(i + 1):
        continue
    else:
        P[i], P[i + 1] = P[i + 1], P[i]
        # print(i + 1, P)
        ans += 1

print(ans)
