import java.util.*;

public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int tblData[] = new int[n];
		
		//?????????????´?
		for(int i = 0; i < n; i++) {
			tblData[i] = sc.nextInt();
		}
		
		//??´???(??????)
		int tmp;
		int k = n - 1;
		while(k > 0) {
			int i = 0;
			while(i < k) {
				if(tblData[i] > tblData[i+1]) {
					tmp = tblData[i];
					tblData[i] = tblData[i+1];
					tblData[i+1] = tmp;
				}
				i++;
			}
			k--;
		}
		
		long sum = 0L;
		for(int i = 0; i < n; i++) {
			sum = sum + tblData[i];
		}
		
		System.out.println(tblData[0] + " " + tblData[n-1] + " " + sum);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int tblData[] = new int[n];
		
		//?????????????´?
		for(int i = 0; i < n; i++) {
			tblData[i] = sc.nextInt();
		}
		
		//??´???(??????)
		int tmp;
		int k = n - 1;
		while(k > 0) {
			int i = 0;
			while(i < k) {
				if(tblData[i] > tblData[i+1]) {
					tmp = tblData[i];
					tblData[i] = tblData[i+1];
					tblData[i+1] = tmp;
				}
				i++;
			}
			k--;
		}
		
		long sum = 0L;
		for(int i = 0; i < n; i++) {
			sum = sum + tblData[i];
		}
		
		System.out.println(tblData[0] + " " + tblData[n-1] + " " + sum);
	}
} Main public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int tblData[] = new int[n];
		
		//?????????????´?
		for(int i = 0; i < n; i++) {
			tblData[i] = sc.nextInt();
		}
		
		//??´???(??????)
		int tmp;
		int k = n - 1;
		while(k > 0) {
			int i = 0;
			while(i < k) {
				if(tblData[i] > tblData[i+1]) {
					tmp = tblData[i];
					tblData[i] = tblData[i+1];
					tblData[i+1] = tmp;
				}
				i++;
			}
			k--;
		}
		
		long sum = 0L;
		for(int i = 0; i < n; i++) {
			sum = sum + tblData[i];
		}
		
		System.out.println(tblData[0] + " " + tblData[n-1] + " " + sum);
	} main {
		
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int tblData[] = new int[n];
		
		//?????????????´?
		for(int i = 0; i < n; i++) {
			tblData[i] = sc.nextInt();
		}
		
		//??´???(??????)
		int tmp;
		int k = n - 1;
		while(k > 0) {
			int i = 0;
			while(i < k) {
				if(tblData[i] > tblData[i+1]) {
					tmp = tblData[i];
					tblData[i] = tblData[i+1];
					tblData[i+1] = tmp;
				}
				i++;
			}
			k--;
		}
		
		long sum = 0L;
		for(int i = 0; i < n; i++) {
			sum = sum + tblData[i];
		}
		
		System.out.println(tblData[0] + " " + tblData[n-1] + " " + sum);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int tblData[] = new int[n]; tblData new int[n] n for(int i = 0; i < n; i++) {
			tblData[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			tblData[i] = sc.nextInt();
		} {
			tblData[i] = sc.nextInt();
		} tblData[i] = sc.nextInt() tblData[i] tblData i sc.nextInt() sc.nextInt sc int tmp; tmp int k = n - 1; k n - 1 n 1 while(k > 0) {
			int i = 0;
			while(i < k) {
				if(tblData[i] > tblData[i+1]) {
					tmp = tblData[i];
					tblData[i] = tblData[i+1];
					tblData[i+1] = tmp;
				}
				i++;
			}
			k--;
		} k > 0 k 0 {
			int i = 0;
			while(i < k) {
				if(tblData[i] > tblData[i+1]) {
					tmp = tblData[i];
					tblData[i] = tblData[i+1];
					tblData[i+1] = tmp;
				}
				i++;
			}
			k--;
		} int i = 0; i 0 while(i < k) {
				if(tblData[i] > tblData[i+1]) {
					tmp = tblData[i];
					tblData[i] = tblData[i+1];
					tblData[i+1] = tmp;
				}
				i++;
			} i < k i k {
				if(tblData[i] > tblData[i+1]) {
					tmp = tblData[i];
					tblData[i] = tblData[i+1];
					tblData[i+1] = tmp;
				}
				i++;
			} if(tblData[i] > tblData[i+1]) {
					tmp = tblData[i];
					tblData[i] = tblData[i+1];
					tblData[i+1] = tmp;
				} tblData[i] > tblData[i+1] tblData[i] tblData i tblData[i+1] tblData i+1 i 1 {
					tmp = tblData[i];
					tblData[i] = tblData[i+1];
					tblData[i+1] = tmp;
				} tmp = tblData[i] tmp tblData[i] tblData i tblData[i] = tblData[i+1] tblData[i] tblData i tblData[i+1] tblData i+1 i 1 tblData[i+1] = tmp tblData[i+1] tblData i+1 i 1 tmp i++ i k-- k long sum = 0L; sum 0L for(int i = 0; i < n; i++) {
			sum = sum + tblData[i];
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			sum = sum + tblData[i];
		} {
			sum = sum + tblData[i];
		} sum = sum + tblData[i] sum sum + tblData[i] sum tblData[i] tblData i System.out.println(tblData[0] + " " + tblData[n-1] + " " + sum) System.out.println System.out System System.out tblData[0] + " " + tblData[n-1] + " " + sum " " tblData[n-1] tblData[0] + " " + tblData[n-1] + " " + sum tblData[0] tblData 0 " " tblData[n-1] tblData n-1 n 1 " " sum String[] args args public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int tblData[] = new int[n];
		
		//?????????????´?
		for(int i = 0; i < n; i++) {
			tblData[i] = sc.nextInt();
		}
		
		//??´???(??????)
		int tmp;
		int k = n - 1;
		while(k > 0) {
			int i = 0;
			while(i < k) {
				if(tblData[i] > tblData[i+1]) {
					tmp = tblData[i];
					tblData[i] = tblData[i+1];
					tblData[i+1] = tmp;
				}
				i++;
			}
			k--;
		}
		
		long sum = 0L;
		for(int i = 0; i < n; i++) {
			sum = sum + tblData[i];
		}
		
		System.out.println(tblData[0] + " " + tblData[n-1] + " " + sum);
	}
} public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int tblData[] = new int[n];
		
		//?????????????´?
		for(int i = 0; i < n; i++) {
			tblData[i] = sc.nextInt();
		}
		
		//??´???(??????)
		int tmp;
		int k = n - 1;
		while(k > 0) {
			int i = 0;
			while(i < k) {
				if(tblData[i] > tblData[i+1]) {
					tmp = tblData[i];
					tblData[i] = tblData[i+1];
					tblData[i+1] = tmp;
				}
				i++;
			}
			k--;
		}
		
		long sum = 0L;
		for(int i = 0; i < n; i++) {
			sum = sum + tblData[i];
		}
		
		System.out.println(tblData[0] + " " + tblData[n-1] + " " + sum);
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int tblData[] = new int[n];
		
		//?????????????´?
		for(int i = 0; i < n; i++) {
			tblData[i] = sc.nextInt();
		}
		
		//??´???(??????)
		int tmp;
		int k = n - 1;
		while(k > 0) {
			int i = 0;
			while(i < k) {
				if(tblData[i] > tblData[i+1]) {
					tmp = tblData[i];
					tblData[i] = tblData[i+1];
					tblData[i+1] = tmp;
				}
				i++;
			}
			k--;
		}
		
		long sum = 0L;
		for(int i = 0; i < n; i++) {
			sum = sum + tblData[i];
		}
		
		System.out.println(tblData[0] + " " + tblData[n-1] + " " + sum);
	}
}