function Main(input){
  let data = input.split('\n');
  let n = data[0];
  let arr = data[1].split(' ').map(Number);
  let changedArr = arr.sort((a,b) =>{
    return a - b;
  });

  let sum = 0;
  changedArr.forEach(a => {
    sum += a;
  });
  
  console.log(changedArr[0], changedArr[n - 1], sum);
  }
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
