"use strict";
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = []
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});

var re = /\s+|$/;
reader.on('close', () => {
    const n = Number(lines[0]);
    var a = lines[1].trim().split(re).map(Number);
    var min, max, sum;

    [min, max, sum] = aux(a);
    console.log(min.toString()+' '+max.toString()+' '+sum.toString());
});

function aux(a)
{
    return [Math.min(...a), Math.max(...a), a.reduce((s,x)=>s+x)];
}
