N = gets.to_i
H = gets.split.map(&:to_i)

max = H[-1]
satisfied = true
H[0..-1].reverse.each do |h|
  if h <= max
    max = h
  else
    if h - 1 == max
      next
    else
      satisfied = false
      break
    end
  end
end

if satisfied
  puts 'Yes'
else
  puts 'No'
end
