N = int(input())
P = list(map(int,input().split()))

ans = 0
check = False

for i in range(N-1):
  if P[i] == i + 1:
    if check:
      check = False
      continue
    ans += 1
    if P[i+1] == i + 2:
      check = True
      
print(ans)