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

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