var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var sp = input.split("\n");
var n = Number(sp[0]);
var ai = sp[1].split(" ").map(Number);
console.log( Math.min.apply( null, ai ) + " " + Math.max.apply( null, ai ) + " " + ai.reduce( ( a, b ) => a + b ) );