import std.stdio, std.string, std.conv;
import std.math;

void main() {
    auto input = getStdin!(string[]);
    auto num = input[1].split(" ").to!(long[]).sort;
    long sum = 0;
    foreach (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);
}