acceptedNumber = gets.to_i
array = gets.chomp.split(" ").map(&:to_i);
cnt = 0

judgeCount = acceptedNumber - 1
judgeCount.times do | i |
  if array[i] == i + 1
    array[i] = array[i + 1]
    cnt += 1
  end
end

puts cnt