n=int(input())
P=list(map(int,input().split()))
ans=0
if P[0]==1:
  P[0]=P[1]
  P[1]=1
  ans+=1
while True:
  flag=True
  for i in range(1,n):
    if P[i]==i+1:
      P[i]=P[i+1]
      P[i+1]=i+1
      ans+=1
      flag=False
  if flag==True:
    break
print(ans)