n = int(input())
l = list(map(int,input().split()))
cou = 0
if l[0]==1:
  x = l[0]
  l[0] = l[1]
  l[1]=x
  cou += 1
for i in range(1,n):
  if l[i]==i+1:
    if l[i-1]==i:
      x = l[i-1]
      l[i-1] = l[i]
      l[i] = x
      cou += 1
    elif i!=n-1:
      x = l[i]
      l[i] = l[i+1]
      l[i+1] = x
      cou += 1
#  print(l)
print(cou)