n, *P = map(int, open(0).read().split())
c = 0
if P[0] == 1:
  c = 1
  P[0] = P[1]
  P[1] = 1
for i, (p0, p1) in enumerate(zip(P, P[1:]), 1):
  if i+1 == p1:
    c += 1
    P[i] = P[i-1]
    P[i-1] = i+1 
print(c)