/**
  * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_4_D
  * Computation - Min, Max and Sum
  */
object Main {
  def main(args: Array[String]): Unit = {
    val n = io.StdIn.readInt()
    val seq = io.StdIn.readLine().split(" ").map(_.toLong).toSeq
    println(s"${seq.min} ${seq.max} ${seq.sum}")
  }
}