function main(input) {
    var data = input.split('\n');
    var size = Number(data[0]);
    //size????????´??°
    var array = data[1].split(' ').map(Number);
    var numSum = 0;
    var output = [];
    var min = 1000000;
    var max = -10000000;
    for (var i = 0; i < size; i++){
        numSum += array[i];
        min = Math.min(min, array[i]);
        max = Math.max(max, array[i]);
    }
    console.log(min, max, numSum);
}
process.stdin.resume();
var input = '';  
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  main(input);
});