n=int(input())
p=list(map(int,input().split()))
p.append(0)
ansls=[0]
if p[0]==1:
  ansls[0]=1
for i in range(1,n):
  if p[i] ==i+1:
    if p[i-1] == i:
      ansls[-1]+=1
  else:
    ansls.append(1)
ans=0
for i in range(len(ansls)):
  ans+= (ansls[i]+1)//2
print(ans)