n=int(input())
p=list(map(int,input().split()))
cnt=0
for i in range(n):
    if p[i]==i+1:
        cnt+=1
        x=1
        if i==n:
            break
        while True:
            if p[i+x]!=i+1:
                temp_v=p[i+x]
                p[i+x]=p[i]
                p[i]=temp_v
                break
            else:
                x+=1
print(cnt)