var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', function (line) {
  var i,b,sum=0;
  var a = line.split(' ');
  var c = parseInt(a[0],10);
  for(i=1;i<=c;i++){
    b = parseInt(a[i],10);
    sum += b;
    lines.push(b);
  }
  reader.close();
  console.log(Math.min.apply(null,lines)+" "+Math.max.apply(null,lines)+" "+sum);
  process.exit();
});
process.stdin.on('end', function () {
});