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

judge = h_arr.length <= 2 ? 1 : 2

flag = 0
h_arr.each_cons(2) do |a, b|
  if a < b
    flag = 0
  elsif a - b > 2
    puts "No"
    exit
  elsif a > b
    flag += 1
  end
  if flag == judge
    puts "No"
    exit 0
  end
end

puts "Yes"
