"use strict"
let input = require('fs').readFileSync('/dev/stdin','utf8');
let arr = input.split('\n')
let n = arr[0];
if (n !== 0) {
	let list = arr[1].split(' ');
	let min = parseInt(list[0]);
	let max = parseInt(list[0]);
	let sum = 0;
	for (let i in list) {
		let v = parseInt(list[i]);
		min = Math.min(min, v);
		max = Math.max(max, v);
		sum += v;
	}
	console.log(min + ' ' + max + ' ' + sum);	
}

