object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt
    var list:List[Int] = Nil
    for( n <- 1 to n) {
      list :+= sc.nextInt
    }
    println(s"${list.min} ${list.max} ${list.sum}")
  }
}