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

if P[0] == 1:
    P[0],P[1] = P[1],P[0]
    ans = 1
else: ans = 0

for i in range(1,n):
    if P[i] == i+1:
        P[i],P[i-1] = P[i-1],P[i]
        ans += 1
    
#print(P)
print(ans)
