num = gets.to_i
input = gets.split.map(&:to_i)

max = input[0]
result = true

(0..(num - 1)).each do |index|
next if index == 0 
if input[index] - input[index-1] < -1 || input[index] - max < -1 
  result = false 
  break
end
  max = [input[index], max].max
end

puts (result ? 'Yes' : 'No')