N = int(input())
P = [int(i) for i in input().split()]

ans = 0
for i,p in enumerate(P):
    if p == i+1:
#         print('i+1,p',i+1,p)
        tmp0 = P[i+1]
        P[i] = tmp0
        P[i+1] = p
        ans += 1
#         print('P',P)
print(ans)