'use strict';
(function(stdin) {
  //declare function

  //declare variable
  var inputs = stdin.toString().trim().split('\n');
  var count = inputs[0];
  var num = inputs[1].split(' ').map(Number).sort(function(a, b) {
    return a - b;
  });
  var result = 0;
  for (var i = 0; i < count; i++) {
    result += num[i];
  }
  console.log(num[0], num[count - 1], result)
    //main
    //display
    //console.log(inputs);
})(require('fs').readFileSync('/dev/stdin', 'utf8'))