n = int(input())
p_ls = list(map(int, input().split()))

wait = 0
ans = 0
for i in range(n):
    if p_ls[i] == i+1:
        wait += 1
    else:
        if wait == 1:
            ans += 1
            wait = 0
        elif wait != 0:
            ans += wait - 1
            wait = 0
if wait == 1:
    ans += 1
elif wait != 0:
    ans += wait - 1
print(ans)
