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

object Main {

  def main(args: Array[String]) = {
    val n = readInt
    val (min,max,sum):(Int,Int,Long) = readLine.split(" ")
                                .map(_.toInt)
                                .foldLeft(Int.MaxValue,Int.MinValue,0.toLong){ case ((min,max,sum),x)=>(Math.min(min,x),Math.max(max,x),sum+x) }
    printf("%d %d %d\n",min,max,sum)
  }
}