object Main{
  def main(args: Array[String]){
    val sc = new java.util.Scanner(System.in)
    val num = sc.nextInt
    var sum = 0
    var list = List[Int]()
    var min = 0L
    var max = 0L
    for(i <- 1 to num){
      val in = sc.nextInt
      if(i == 1){
        min = in
        max = in
      }

      if(in < min){
        min = in
      }
      if(in > max){
        max = in
      }
      sum = in + sum
    }

    println(min + " " + max + " " + sum)
  }
}