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

#print(P)
ans = 0
for j in range(N):
    p = P[j]
    i = j + 1
    if p == i:
        if i == 1:
            ans += 1
            P[j], P[j+1] = P[j+1], P[j]
        else:
            ans += 1
            P[j-1], P[j] = P[j], P[j-1]
#print(P)
print(ans)
