import numpy as np

n = int(input())
p = np.array(list(map(int, input().split())))
l = np.arange(1,n+1)
cnt = np.count_nonzero(l-p == 0)
ans = 0

if cnt == 0:
  print(ans)
else:
  for i in range(n-1):
    if p[i] == i+1:
      ans += 1
      p[i+1]=0
  else:
    print(ans)