N = int(input())
P = list(map(int, input().split()))
res = 0
for idx in range(len(P)):
    if P[idx] == idx + 1:
        # if idx < N:
        #     P[idx], P[idx+1] = P[idx+1], P[idx]
        res += 1

print(res)
