n=int(input())
f1=list(map(int,input().split()))
c=0
for i in range(n-1):
    if f1[i]==i+1:
        c+=1
        f1[i],f1[i+1]=f1[i+1],f1[i]
if f[n-1]==n:
  	f[n-2],f[n-1]=f[n-1],f[n-2]
  	c+=1  
print(c)