N = int(input())
A = list(map(int, input().split()))
cnt = 0
for i, a in enumerate(A, 1):
  if a == i:
    if i == len(A) + 1:
      x = a[i - 1]
      y = a[i]
      a[i - 1] = y
      a[i] = x    
      cnt += 1
    else:
      x = a[i - 2]
      y = a[i - 1]
      a[i - 2] = y
      a[i - 1] = x    
      cnt += 1
print(cnt)
