var input = '';
var readable = process.stdin;
readable.resume();
readable.setEncoding( 'utf-8' );
readable.on( 'data', function( chunk ) {
  input += chunk;
});

readable.on( 'end', function() {
  var data = input.split( '\n' );
  var n = data[0].replace( '\n', '' );
  var nums = data[1].replace( '\n', '' ).split( ' ' ).map( Number );
  var sum = 0;
  var max = -1000000;
  var min = 1000000;
  for( var i=0; i<nums.length; i++ ) {
    min = Math.min( min, nums[i] );    
    max = Math.max( max, nums[i] );
    sum += nums[i];
  }
  console.log( '%d %d %d', min, max, sum  );
});