object Main {
  
  def main(args: Array[String]) {
    readLine()
    var (min, max, sum) = (Int.MaxValue, Int.MinValue, 0L)
    readLine().split(" ").map(_.toInt).foreach(x => {
      min = Math.min(min, x)
      max = Math.max(max, x)
      sum += x
    })
    println(s"$min $max $sum")
  }
}
