n=int(input())
P=list(map(int,input().split()))

ans=0
if P[0]==1:
  P[0]=P[1]
  P[1]=1
  ans+=1
for i in range(1,n):
  if P[i]==i+1:
    if P[i+1]!=i+2:
      P[i]=P[i+1]
      P[i+1]=i+1
    else:
      P[i]=P[i-1]
      P[i-1]=i+1
    ans+=1
print(ans)