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 and p[i + 1] == i + 2:
            cnt -= 1
        cnt += 1

print(cnt)
        