function Main(input) {
    input = input.split("\n");
    for (i=0; i < input.length-1; i = i + 2) {
        var n = parseInt(input[i])
        var num = []
        tmp = input[1].split(" ")
        for (j=0; j < n; j++) {
            num.push(tmp[j])
        }
        var max = Math.max.apply(null, num)
        var min = Math.min.apply(null, num)
        var sum = 0
        for (k=0; k < num.length; k++) {
            sum += parseInt(num[k])
        }
        console.log(min, max, sum)
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
