const input = require('fs').readFileSync('/dev/stdin', 'utf8').split(/\n/);
let num = input[1].split(' ').map(Number);
num.sort(function(a,b){ return a - b ;});
let min = num[0];
let max = num[num.length - 1];
let sum = 0;
for (let i=0; i<num.length; i++) {
        sum += num[i];
}
 console.log(min + ' ' + max + ' ' + sum)
