n = int(input())
l = list(map(int, input().split()))
ans = 0
i = 0
while True:
  if i >= n:
    break
  if l[i] == i + 1:
    ans += 1
  
  try:
    if l[i+1] == i + 2:
      i += 2
      continue
  except IndexError:
    pass
  
  i += 2

print(ans)