import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	public static int exception(ArrayList<Integer> parse){
		int result = 0;
		for(int j = 0; j < parse.size(); ++j){
			if(parse.get(j) < -1000000 || parse.get(j) > 1000000){
				result = 0;
			}
			else {
				result = 1;
			}
		}
		return result;
	}
	public static void main(String[] args){
		/**
		 * ?????°?????£?¨?
		 */
		int n=0;
		int a=0,b=0; //int????????¨?????°
		long sum = 0;
		String str;
		/**
		 * ???????????£?¨?
		 */
		ArrayList<String> st = new ArrayList<String>();
		ArrayList<Integer> parse = new ArrayList<Integer>();
		/**
		 * ?????????????????\?????¨????????????????´?
		 */
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt(); //????????°
		for(int i = 0;i < n; ++i){
			st.add(scan.next());
			parse.add(Integer.parseInt(st.get(i))); //int????????¨int????????????????´?
			sum += parse.get(i); // ????¨????
		}
		Collections.sort(parse); //int???????????????????????????
		if(exception(parse) == 0){
			System.out.println("??\??????????????§???.???????????????.");
		}
		else if(exception(parse) == 1){
		System.out.println(parse.get(0)+" "+parse.get(n-1)+" "+sum);
		}
	}

}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz