n = int(input())
ps = list(map(int, input().split()))

cnt = 0
for i, p in enumerate(ps):
  if i == 0:
    pass
  else:
    if ps[i-1] == i:
      tmp = ps[i-1]
      ps[i-1] = ps[i]
      ps[i] = tmp
      cnt += 1
    elif ps[i] == i+1:
      tmp = ps[i-1]
      ps[i-1] = ps[i]
      ps[i] = tmp
      cnt += 1
    else:
      pass
print(cnt)