n = gets.to_i
h = gets.chomp.split.map(&:to_i)

if n == 1
  puts "Yes"
  exit
end

minnum = h[n - 1]
(n - 2).downto(0) do |i|
  if h[i] > h[i + 1]
    minnum = h[i] if h[i] < minnum
    if h[i] - minnum > 1
      puts "No"
      exit
    end
  else
    minnum = h[i]
  end
end
puts "Yes"