var chunk = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = chunk.split('\n');
// var n  =  Number(lines[0]);
var a = lines[1].split(' ').map(Number);

var sum = function (a, b) {return a + b; };

console.log(Math.min.apply(null, a), Math.max.apply(null, a), a.reduce(sum));