n=int(input())
a=list(map(int,input().split()))
k=0
ans=0
while k<n:
  if a[k]==k and a[k+1]==k:
    k+=2
    ans+=1
  elif a[k]==k and a[k+1]!=k:
    k+=1
    ans+=1
  else:
    pass
print(ans)
    
    