
import java.util.*;

public class Main {
	public static void main(String args[]) throws NumberFormatException{
		Scanner scan = new Scanner(System.in);
		long sum;//??´??°?????°
		int n;
		n = scan.nextInt();
		sum = 0;//????¨??????¨????????????
		
		List<Integer> list = new ArrayList<Integer>();
		
		//n?????????????????????????????\??????
		for(int count = 0; count < n ; count++){
			list.add(scan.nextInt());
			
		}
		
		
		//??????????????????????????????????????¨??????????????????????????????n-1
		Collections.sort(list);
		
		//??¨????????????????¨?????????¨???
		for(int i =0;i < list.size();i++){
			sum = sum + list.get(i);
		}
		
		System.out.println(String.valueOf(list.get(0)) + " " + String.valueOf(list.get(n-1)) + " " + String.valueOf(sum));
		
		
	}
} import java.util.*; util.* java public class Main {
	public static void main(String args[]) throws NumberFormatException{
		Scanner scan = new Scanner(System.in);
		long sum;//??´??°?????°
		int n;
		n = scan.nextInt();
		sum = 0;//????¨??????¨????????????
		
		List<Integer> list = new ArrayList<Integer>();
		
		//n?????????????????????????????\??????
		for(int count = 0; count < n ; count++){
			list.add(scan.nextInt());
			
		}
		
		
		//??????????????????????????????????????¨??????????????????????????????n-1
		Collections.sort(list);
		
		//??¨????????????????¨?????????¨???
		for(int i =0;i < list.size();i++){
			sum = sum + list.get(i);
		}
		
		System.out.println(String.valueOf(list.get(0)) + " " + String.valueOf(list.get(n-1)) + " " + String.valueOf(sum));
		
		
	}
} Main public static void main(String args[]) throws NumberFormatException{
		Scanner scan = new Scanner(System.in);
		long sum;//??´??°?????°
		int n;
		n = scan.nextInt();
		sum = 0;//????¨??????¨????????????
		
		List<Integer> list = new ArrayList<Integer>();
		
		//n?????????????????????????????\??????
		for(int count = 0; count < n ; count++){
			list.add(scan.nextInt());
			
		}
		
		
		//??????????????????????????????????????¨??????????????????????????????n-1
		Collections.sort(list);
		
		//??¨????????????????¨?????????¨???
		for(int i =0;i < list.size();i++){
			sum = sum + list.get(i);
		}
		
		System.out.println(String.valueOf(list.get(0)) + " " + String.valueOf(list.get(n-1)) + " " + String.valueOf(sum));
		
		
	} main {
		Scanner scan = new Scanner(System.in);
		long sum;//??´??°?????°
		int n;
		n = scan.nextInt();
		sum = 0;//????¨??????¨????????????
		
		List<Integer> list = new ArrayList<Integer>();
		
		//n?????????????????????????????\??????
		for(int count = 0; count < n ; count++){
			list.add(scan.nextInt());
			
		}
		
		
		//??????????????????????????????????????¨??????????????????????????????n-1
		Collections.sort(list);
		
		//??¨????????????????¨?????????¨???
		for(int i =0;i < list.size();i++){
			sum = sum + list.get(i);
		}
		
		System.out.println(String.valueOf(list.get(0)) + " " + String.valueOf(list.get(n-1)) + " " + String.valueOf(sum));
		
		
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) long sum; sum int n; n n = scan.nextInt() n scan.nextInt() scan.nextInt scan sum = 0 sum 0 List<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() for(int count = 0; count < n ; count++){
			list.add(scan.nextInt());
			
		} int count = 0; int count = 0; count 0 count < n count n count++ count++ count {
			list.add(scan.nextInt());
			
		} {
			list.add(scan.nextInt());
			
		} list.add(scan.nextInt()) list.add list scan.nextInt() scan.nextInt scan Collections.sort(list) Collections.sort Collections list for(int i =0;i < list.size();i++){
			sum = sum + list.get(i);
		} int i =0; int i =0; i 0 i < list.size() i list.size() list.size list i++ i++ i {
			sum = sum + list.get(i);
		} {
			sum = sum + list.get(i);
		} sum = sum + list.get(i) sum sum + list.get(i) sum list.get(i) list.get list i System.out.println(String.valueOf(list.get(0)) + " " + String.valueOf(list.get(n-1)) + " " + String.valueOf(sum)) System.out.println System.out System System.out String.valueOf(list.get(0)) + " " + String.valueOf(list.get(n-1)) + " " + String.valueOf(sum) " " String.valueOf(list.get(n-1)) String.valueOf(list.get(0)) + " " + String.valueOf(list.get(n-1)) + " " + String.valueOf(sum) String.valueOf(list.get(0)) String.valueOf String list.get(0) list.get list 0 " " String.valueOf(list.get(n-1)) String.valueOf String list.get(n-1) list.get list n-1 n 1 " " String.valueOf(sum) String.valueOf String sum String args[] args public class Main {
	public static void main(String args[]) throws NumberFormatException{
		Scanner scan = new Scanner(System.in);
		long sum;//??´??°?????°
		int n;
		n = scan.nextInt();
		sum = 0;//????¨??????¨????????????
		
		List<Integer> list = new ArrayList<Integer>();
		
		//n?????????????????????????????\??????
		for(int count = 0; count < n ; count++){
			list.add(scan.nextInt());
			
		}
		
		
		//??????????????????????????????????????¨??????????????????????????????n-1
		Collections.sort(list);
		
		//??¨????????????????¨?????????¨???
		for(int i =0;i < list.size();i++){
			sum = sum + list.get(i);
		}
		
		System.out.println(String.valueOf(list.get(0)) + " " + String.valueOf(list.get(n-1)) + " " + String.valueOf(sum));
		
		
	}
} public class Main {
	public static void main(String args[]) throws NumberFormatException{
		Scanner scan = new Scanner(System.in);
		long sum;//??´??°?????°
		int n;
		n = scan.nextInt();
		sum = 0;//????¨??????¨????????????
		
		List<Integer> list = new ArrayList<Integer>();
		
		//n?????????????????????????????\??????
		for(int count = 0; count < n ; count++){
			list.add(scan.nextInt());
			
		}
		
		
		//??????????????????????????????????????¨??????????????????????????????n-1
		Collections.sort(list);
		
		//??¨????????????????¨?????????¨???
		for(int i =0;i < list.size();i++){
			sum = sum + list.get(i);
		}
		
		System.out.println(String.valueOf(list.get(0)) + " " + String.valueOf(list.get(n-1)) + " " + String.valueOf(sum));
		
		
	}
} Main

import java.util.*;

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