import std.stdio, std.string, std.conv;
import std.algorithm, std.array;

void main() {
	auto input = getStdin!(string[])()[1];
	int[] num = input.split(" ").to!(int[]).sort;
	int sum = 0;
	foreach (int n; num) {
		sum += n;
	}
	
	writefln("%d %d %d", num[0], num[num.length-1], sum);
}

T getStdin(T)() {
    string[] cmd;
    string line;
    while ((line = chomp(stdin.readln())) != "") cmd ~= line;
    return to!(T)(cmd);
}