N = int(input())
p = list(map(int, input().split()))

count = 0
now = 0
for i in range(len(p)):
    if len(p) == 0:
        break
    if now+1 == p[0]:
        p.pop(0)
        count += 1
        now += 1
    p.pop(0)
    now += 1
print(count)
