n = int(input())
m = map(int , input().split())

#入れ替える必要のある要素のインデントを格納
l = []
for i,item in enumerate(m):
  if i+1 == item:
    l.append(i)

sec = True
ans = len(l)

for i,item in enumerate(l):
  if i == 0:
    continue

  if item != l[i-1]+1:
    sec == False
  else:
    if sec == False:
      sec = True
    else:
      ans -= 1
      sec = False
print(ans)





