n = int(input())
p = list(map(int, input().split()))
ans = 0
cnt = 0
for i in range(n):
    if p[i] != (i + 1) or i == n - 1:
        ans += cnt
        cnt = 0
    if p[i] == (i + 1):
        cnt = 1
print(ans)