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

cnt = [0]*n
for i in range(n):
    if P[i] == i+1:
        cnt[i] += 1

if cnt.count(1) == 0:
    print(0)
else:
    ans, i = 0, 0
    while i < n-1:
        if cnt[i] == 1:
            if cnt[i+1] == 1:
                ans += 1
                i += 2
            else:
                ans += 1
                i += 1
        else:
            i += 1
    if cnt[-1] == 1:
        ans += 1

    print(ans)
