N = int(input())
P = [int(s) - 1 for s in input().split()]
ans = 0
i = 0
while i < len(P) - 1:
    if P[i] == i:
        ans += 1
        i += 2
    else:
        i += 1
if P[N - 2] != N - 2 and P[N - 1] == N - 1:
    ans += 1
print(ans)
