n = gets.chomp.to_i
h = gets.chomp.split.map(&:to_i)
flag = false
(n-1).times do |i|
  if h[i+1] - h[i] < -1
    puts "No"
    exit
  elsif h[i+1] - h[i] == -1 && flag
    puts "No"
    exit
  elsif h[i+1] - h[i] == -1
    flag = true
  elsif h[i+1] - h[i] > 0
    flag = false
  end
end
puts "Yes"
