# frozen_string_literal: true

def gudge(arr)
  low_index = arr.rindex(0)
  high_index = arr.index { |elem| elem >= 2 }
  return false if !high_index.nil? && high_index < low_index
  true
end

def normalize!(arr)
  min = arr.min
  arr.map! do |elem|
    elem - min
  end
end

STDIN.gets
input_h = STDIN.gets.split.map(&:to_i)
normalize! input_h
puts gudge(input_h) ? 'Yes' : 'No'
