#include<iostream>//itp14d.cpp
using namespace std;
int main(void)
{
	long long int n,m,i,max=0,min=10000000,all=0;
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>m;
		all=all+m;
		if(max<=m) max=m;
		if(min>=m) min=m;
	}
	if(n==1) cout<<m<<" "<<m<<" "<<m<<endl;
	else cout<<min<<" "<<max<<" "<<all<<endl;
	return 0;
}

/*
?????§??§ 1000000 ??????????????§ 10000 ?????\?????????????????§?????????????????¨????¶??????????????????´?????????????????????1010 ????¨???????????????¨?????§?????????????????????????????????????????? 

int ??§????¶???????????????§???long long (??\?????¬??¬)????????¨??????
??¬??¬????????¬???????????????????????°?¢??????\??£????????????64bit????????§900????????§????????????
http://oshiete.goo.ne.jp/qa/56545.html
http://okwave.jp/qa/q2099363.html

printf?????????%lld??????????????§??¨???
*/

#include <iostream>
#include <cstdio>

using namespace std;

int main() {
	int a[10000];
	int n;
	int max=-1000000,min=1000000;
	long long sum=0;
	
	cin >> n;
	if(n==0){
		printf("%d %d %d\n", 0, 0, 0);
		return 0;
	}
	
	for(int i=0; i<n; i++){
		cin >> a[i];

		sum+=a[i];
		if(max<a[i]) max = a[i];
		if(min>a[i]) min = a[i];
	}
	
	printf("%d %d %lld\n", min, max, sum);
		

	return 0;
}