#include<iostream>
#include<vector>
#include<algorithm>


using namespace std;

int main(){

	long long n,m,sum=0;
	cin>>n;
	vector<long long> vec;
	for(int i=0;i<n;++i){
		cin>>m;
		vec.push_back(m);
		sum+=m;
	}

	sort(vec.begin(),vec.end());
	long long max,min;
	max=vec[n-1];
	min=vec[0];

	cout<<min<<" "<<max<<" "<<sum<<endl;
	
	return 0;
}
#include<iostream>

int main(void){
	int n, min = 1000000, max = -1000000;
	long long sum = 0;
	
	std::cin >> n;
	if (n == 0) return 0;
	
	for (int i = 0; i < n; i++){
		int x;
		std::cin >> x;
		sum = sum + x;
		if (min > x) min = x;
		if (max < x) max = x;
	}
	
	std::cout << min << " " << max << " " <<  sum << std::endl;
	
	return 0;
}