N = int(input())
nums = list(map(int, input().split()))
cnt = 0
ren = 0
for i in range(N):
  if nums[i] == i+1:
    cnt += 1
    ren += 1
  elif ren > 1:
    cnt -= 1
    ren = 0
  else:
    ren = 0
if ren > 1:
  cnt -= 1
print(cnt)
