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

void main()
{
    readln();
    auto a = readln().split.map!(to!int);
    writefln("%d %d %d", a.reduce!min, a.reduce!max, sum(a));
}