'use strict';
(function(stdin) {
  var lines  = stdin.toString().split('\n');
  var result = (function(data) {
  	return [
  		Math.min.apply(0,data)
  		,Math.max.apply(0,data)
  		,data.reduce(function(a,b){return a + b;})
  	].join(' ');
  }(lines[1].split(' ').slice(0,lines[0]).map(Number)
  ));
  console.log(result);
}(require('fs').readFileSync('/dev/stdin', 'utf8')));