N=int(input())
p=list(map(int, input().split()))
i = 1
res = 0
while i<len(p):
    if i==p[i-1] and i+1==p[i]:
        res += 1
        i += 2
    elif i==p[i-1]:
        res += 1
        i += 1
    else:
        i += 1
print(res)
