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

flag = 0
ans = 0
for i, num in enumerate(nums):
  if i == num:
    if flag:
      ans += 1 
      flag = 0
    else:
      flag = 1
  else:
    if flag == 1:
      ans += 1
      flag = 0
      
if flag == 1:
  ans += 1
  
print(ans)