var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var x = input.split('\n');
var n = parseInt(x[0]);
var a = x[1].split(' ').map(Number);
var max = Math.max(...a);
var min = Math.min(...a);
var total = a.reduce((p, q) => p + q, 0);
console.log(min,max,total);
