process.stdin.resume();
process.stdin.setEncoding('utf8');

var chunks = [];
process.stdin.on('data', function(chunk) {
    chunks.push(chunk.toString());
});
process.stdin.on('end', function() {
    main(chunks.join(""));
});

function main(input) {
 var lines = input.split("\n");
 var no = Number(lines[0]);
 var hoge = lines[1].split(" ").map(Number);
  
 var sum = 0;
 var max = hoge[0];
 var min = hoge[0];
  
 for(var i = 0; i < no; i++){
    var a = hoge[i];
    if (a > max){
        max = a;
    }
    if (a < min){
        min = a;
    }
    sum += a;
 }
  
 console.log(min, max, sum);
}