object Main {
  val MinValue = -1000000
  val MaxValue = 1000000

  def main(args: Array[String]): Unit = {
    val n = io.StdIn.readInt()
    val nums = io.StdIn.readLine().split(" ").map(_.toInt)
    val (min, max, sum) =
      nums.foldLeft((MaxValue, MinValue, 0L)) { case (acc, num) =>
        (acc._1.min(num), acc._2.max(num), acc._3 + num)
      }
    println(s"$min $max $sum")
  }
}