const input = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n');
const a = input[1].split(' ').map(Number);
const result = [];
result.push(a.reduce(function(a, b) {
  return a < b ? a : b;
}));
result.push(a.reduce(function(a, b) {
  return a > b ? a : b;
}));
result.push(a.reduce(function(a, b) {
  return a + b;
}));
console.log(result.join(' '));