N, *X = map(int, open(0).read().split())

ans = 0
tmp = 0
for i in range(N):
    if X[i] == i + 1:
        tmp += 1
        if tmp == 2:
            ans += 1
            tmp = 0
    else:
        ans += int(tmp > 0)
        tmp = 0

print(ans)
