n = int(input())
list_p = list(map(int, input().split()))
same_p = [1 if i+1 == p else 0 for i, p in enumerate(list_p)]

count = 0
i = 0
while i < n:
  if sum(same_p) == 0:
    break
  if same_p[i] == 1:
    temp_p = list_p[i]
    list_p[i] = list_p[i+1]
    list_p[i+1] = temp_p
    same_p[i] = 0
    same_p[i+1] = 0
    if list_p[i+1] == i+2:
      same_p[i+1] = 1
    count += 1
  i += 1
print(count)