import io.StdIn.{readInt, readLine}
object Main extends App {
  val n = readInt
  val as = readLine.split(" ").map(_.toLong)

  val sorted = as.sorted.reverse
  val result = (0 until n)
                .map(_*2)
                .map(_+1)
                .map(sorted(_))
                .sum

  println(result)
}