import scala.io.Source

object Main extends App {

  val li: List[Int] = Source.stdin.getLines.toList.last.split(" ").toList.map(_.toInt).sorted

  val min = li.head
  val max = li.last
  def sum(li: List[Int]): Int = li match {
    case Nil => 0
    case h :: tail => h + sum(tail)
  }
  println(min + " " + max + " " + sum(li))
}