n=gets.chomp.to_i
array=gets.chomp.split(' ').map(&:to_i)
min = max = array[0]
kq = true
if n == 1
  kq = true
else
  array.each_with_index do |value, index|
    next if index == n -1
    kq = false if value - array[index+1] > 1
    min = value < min ? value : min
    kq = false if min - array[index+1] > 1
    max = value > max ? value : max
    kq = false if max - array[index+1] > 1
  end
end
str = kq ? "Yes" : "No"
puts str