var std = process.stdin;
std.resume();
std.setEncoding('utf8');
std.on('data', function (chunk) {
    var data = chunk.split(/\n/g);
    var nums = data[1].split(' ').map(Number);
    
    var sum = nums.reduce(function(p, c){
        return p + c; 
    });
    
    console.log(Math.min.apply(null, nums) + ' ' + 
                Math.max.apply(null, nums) + ' ' + 
                sum);
});