n = int(input().strip())
p = list(map(int, input().split()))

ans = 0
tmp = False
for i in range(len(p)):
    if tmp:
        ans += 1
        tmp = False
    elif p[i] == (i + 1):
        tmp = True
print(ans)
