n = int(input())
p = list(map(int, input().split()))
k = 0
flag = False
for i in range(n):
  if p[i] == i+1:
    k += 1
    if flag:
      k -= 1
      flag = False
    else:
      flag = True

print(k)