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

void main() {
    int n = readln.chomp.to!int;
    long[] a = readln.chomp.split.to!(long[]);
    a.sort;
    writeln(a[0], " ", a[n-1], " ", a.sum);
}
