N = int(input())
P = list(map(int, input().split()))
cnt = 0
for i in range(N):
    if i+1 == P[i]:
        if i + 1 == N:
            cnt += 2
        else:
            P[i], P[i+1] = P[i+1], P[i]
        cnt += 1
print(cnt)
