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


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long total = 0;
		ArrayList<Integer> list = new ArrayList<Integer>();
		
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		//????????§???????????????
		Collections.sort(list);
		for (int i = 0; i < list.size(); i++) {
			total += list.get(i);
		}
		//????°????????????§??????????¨???????????????????
		System.out.println(list.get(0) +" "+ list.get(list.size()-1) +" "+ total);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long total = 0;
		ArrayList<Integer> list = new ArrayList<Integer>();
		
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		//????????§???????????????
		Collections.sort(list);
		for (int i = 0; i < list.size(); i++) {
			total += list.get(i);
		}
		//????°????????????§??????????¨???????????????????
		System.out.println(list.get(0) +" "+ list.get(list.size()-1) +" "+ total);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long total = 0;
		ArrayList<Integer> list = new ArrayList<Integer>();
		
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		//????????§???????????????
		Collections.sort(list);
		for (int i = 0; i < list.size(); i++) {
			total += list.get(i);
		}
		//????°????????????§??????????¨???????????????????
		System.out.println(list.get(0) +" "+ list.get(list.size()-1) +" "+ total);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long total = 0;
		ArrayList<Integer> list = new ArrayList<Integer>();
		
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		//????????§???????????????
		Collections.sort(list);
		for (int i = 0; i < list.size(); i++) {
			total += list.get(i);
		}
		//????°????????????§??????????¨???????????????????
		System.out.println(list.get(0) +" "+ list.get(list.size()-1) +" "+ total);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc long total = 0; total 0 ArrayList<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			list.add(sc.nextInt());
		} {
			list.add(sc.nextInt());
		} list.add(sc.nextInt()) list.add list sc.nextInt() sc.nextInt sc Collections.sort(list) Collections.sort Collections list for (int i = 0; i < list.size(); i++) {
			total += list.get(i);
		} int i = 0; int i = 0; i 0 i < list.size() i list.size() list.size list i++ i++ i {
			total += list.get(i);
		} {
			total += list.get(i);
		} total += list.get(i) total list.get(i) list.get list i System.out.println(list.get(0) +" "+ list.get(list.size()-1) +" "+ total) System.out.println System.out System System.out list.get(0) +" "+ list.get(list.size()-1) +" "+ total " " list.get(list.size()-1) list.get(0) +" "+ list.get(list.size()-1) +" "+ total list.get(0) list.get list 0 " " list.get(list.size()-1) list.get list list.size()-1 list.size() list.size list 1 " " total String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long total = 0;
		ArrayList<Integer> list = new ArrayList<Integer>();
		
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		//????????§???????????????
		Collections.sort(list);
		for (int i = 0; i < list.size(); i++) {
			total += list.get(i);
		}
		//????°????????????§??????????¨???????????????????
		System.out.println(list.get(0) +" "+ list.get(list.size()-1) +" "+ total);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long total = 0;
		ArrayList<Integer> list = new ArrayList<Integer>();
		
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		//????????§???????????????
		Collections.sort(list);
		for (int i = 0; i < list.size(); i++) {
			total += list.get(i);
		}
		//????°????????????§??????????¨???????????????????
		System.out.println(list.get(0) +" "+ list.get(list.size()-1) +" "+ total);
	}
} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long total = 0;
		ArrayList<Integer> list = new ArrayList<Integer>();
		
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		//????????§???????????????
		Collections.sort(list);
		for (int i = 0; i < list.size(); i++) {
			total += list.get(i);
		}
		//????°????????????§??????????¨???????????????????
		System.out.println(list.get(0) +" "+ list.get(list.size()-1) +" "+ total);
	}
}