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

min=1
(n-1).times do |index|
  if h[index]-1 > h[index+1] || h[index+1] < min
    puts 'No'
    exit
  end

  if h[index] > min
    min = h[index] 
    if h[index]-1 == h[index+1]
      min -=1
    end
  end

end

puts 'Yes'


