n = gets.chomp.to_i
h = []
h = gets.chomp.split.map(&:to_i)
ans = 'Yes'
max = 0
idx = 0
h.each_with_index do |elem, i|
  if elem + 1 < max
    ans = 'No'
    break
  end

  if max < elem
    max = elem
    idx = i
  end
end
puts ans