n=int(input())
a=list(map(lambda x:int(x)-1,input().split()))

cnt=0
lis=[]
for i in range(n-1):
    if i in lis:
        continue
    if a[i]==i and a[i+1]==i+1:
        cnt+=1
        lis.append(i+1)
    elif a[i]==i:
        cnt+=1
print(cnt)