N = gets.to_i
H = gets.split.map(&:to_i)
result = "Yes"
top = H[-1]
H.reverse.each do |h|
  if h <= top
    top = h
  else
    if h-1 == top
      next
    else
      result = "No"
      break
    end
  end
end
puts result