N = int(input())
p = list(map(int, input().split()))
i = 0
ans = 0
while(i < N - 1):
    if i > N - 1:
        break
    if p[i] == i + 1:
        ans += 1
        if p[i + 1] == i + 2:
            i += 2
    i += 1
print(ans)