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

void main()
{
auto n = readln.chomp.to!int;
auto a = readln.split.to!(int[]);
writefln("%s %s %s", a.reduce!(min), a.reduce!(max), a.sum);
}
