N = int(input())
p = list(map(int,input().split()))
ret = 0
flag = 0
for i in range(len(p)):
  if i + 1 == p[i]:
    if flag == 0:
      ret += 1
      if p[i+1] == i+2:
        flag = 1
    else:
      flag = 0
print(ret)