N = gets.chomp.to_i
p = gets.chomp.split(' ').map(&:to_i)

prev = false
count = 0
p.each_with_index do |pi, i|
  if pi == i + 1
    if prev
      count += 1
      prev = false
    else
      prev = true
    end
  else
    if prev
      count += 1
      prev = false
    end
  end
end

print count