object Main {

    def main(args: Array[String]) = {
        val sc = new java.util.Scanner(System.in)
        val n = sc.nextInt
        val a = Array.fill(n)(sc.nextLong).sorted

        println(a.head + " " + a.last + " " + a.foldLeft(0L){ (acc, x) => acc+x })
    }
}

