line = require('fs').readFileSync('/dev/stdin', 'ascii').split("\n");
a = line[1].split(" ").map(Number);
min = a.reduce(function(prev, cur, i, ary) {
    return (cur < prev) ? cur : prev;
}, Number.MAX_VALUE);
max = a.reduce(function(prev, cur, i, ary) {
    return (cur > prev) ? cur : prev;
}, -Number.MAX_VALUE);
sum = a.reduce(function(prev, cur, i, ary) { return prev + cur; }, 0);
console.log(min, max, sum);