n=int(input())
import numpy as np
a=np.array(input().split(),dtype=int)
np.append(a,[0])
i=0
ans=0
while i<a.size:
  if a[i]==i+1:
    ans+=1
    if a[i+1]==i+2:
      i+=2
      continue
  i+=1
print(ans)