n = gets.to_i
p = gets.split.map(&:to_i)

n_swap = 0
for i in 0 ... n  do
  for j in 0 ... n-1 do
    if p[j] == j+1 then
      p[j], p[j+1] = p[j+1], p[j]
      n_swap += 1
    end
  end
end
puts n_swap