n=int(input())
*p,=map(int,input().split())
order=1
cnt=0
a=[]
for i in p:
    if i==order:
        a.append(False)
    else:
        a.append(True)
    order+=1
for i in range(n-1):
    if a[i]==False and a[i+1]==False:
        a[i]=True
        a[i+1]=True
        cnt+=1
    elif a[i]==False and a[i+1]==True:
        a[i]=True
        a[i+1]=True
        cnt+=1
print(cnt)

