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 > 1:
            if wait % 2 ==0:
                ans += wait //2
            else:
                ans += wait - 1
            wait = 0
if wait == 1:
    ans += 1
    wait = 0
elif wait > 1:
    if wait % 2 ==0:
        ans += wait //2
    else:
        ans += wait - 1
    wait = 0
print(ans)

