import scala.io.StdIn.{readLine,readInt}

object Main {

  def main(args: Array[String]) = {
    val n = readInt
    val l = readLine.split(" ").map(_.toInt)
    printf("%d %d %d\n",l.min,l.max,l.foldLeft(0.toLong)(_+_))
  }
}