"use strict";

function Main(input) {
    input=input.split("\n");
    var sum=0,line=input[1].split(" ").map(Number);
    for(var value in line)
        sum+=line[value];
    console.log(Math.min.apply(null,line)+" "+Math.max.apply(null,line)+" "+sum);
}
    
function debug(){
	var input = document.getElementById("input").value;
	Main(input);
}

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