n = gets.to_i
h = gets.chomp.split.map(&:to_i)
tmp = h[0] + 1
len = 0
max = 0
h.each do |hi|
  if hi < tmp
    len += 1

    if tmp - hi >= 2
      puts 'No'
      exit
    end
  else
    max = [max, len].max
    len = 1
  end

  tmp = hi
end
puts [max, len].max >= 3 ? 'No' : 'Yes'