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

counter = 0
prev = 0
n.times do |i|
  if prev - h[i] == 1 then
    counter += 1
  elsif prev - h[i] > 1 then
    puts 'No'
    exit
  elsif prev - h[i] < 0 then
    counter = 0
  end
  if counter == 2 then
    puts 'No'
    exit
  end
  prev = h[i]
end
puts 'Yes'
