n=int(input())
arr=list(map(int,input().split()))
ans=0
for i in range(n-1):
  if arr[i]==i+1 or arr[i+1]==i+2:
    arr[i],arr[i+1]=arr[i+1],arr[i]
    ans+=1
if arr[-1]==n or arr[-2]==n-1:
  ans+=1
print(ans)