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

def sorted?
  each_cons(2).all? {|a, b| a <= b }
end

n.times do |i|
  if i < h.length - 1
    if h[i] > h[i+1]
      c += h[i] - h[i+1]
    end
  end
end

if c <= 1
  puts "Yes"
else
  puts "No"
end
