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

swap_count = 0
counter = 0
skip = False
for i in range(1, n+1):
  p = ps[counter]
  counter += 1
  if skip:
    skip = False
    continue
  if i != p:
    skip = True
    swap_count += 1
    
print(swap_count)