N,*P=map(int,open(0).read().split());c=0
ranged=lambda:any(i==P[i]for i in range(N))
while ranged():
 for i in range(N-1):
  if i+1==P[i]and i+2==P[i+1]:P[i],P[i+1]=P[i+1],P[i];c+=1
 for i in range(N-1):
  if i+1==P[i]or i+2==P[i+1]:P[i],P[i+1]=P[i+1],P[i];c+=1
print(c)