N=int(input())
p=list(map(int, input().split()))
#print(N, p)
p.append(N*2)
count=0
i=0
while i<=N-2:
    if i==p[i-1]:
        #print(i, p[i-1])
        if i+1==p[i+1-1]:
            count+=1
            i+=1
        else:
            count+=1
    i+=1
print(count)


