import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] arges) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		int v = Integer.parseInt(line);
		int[] m = new int[v];

		String line2 = sc.nextLine();
		String[] k = line2.split(" ");
		int[] y = new int[m.length];
		for (int i = 0; i < m.length; i++) {
			y[i] = Integer.parseInt(k[i]);
		}
		Arrays.sort(y);
		long sum = 0;
		for (int i = 0; i < y.length; i++) {
			sum += y[i];
		}
		System.out.print(y[0]);
		System.out.print(" " + y[y.length - 1]);
		System.out.println(" " + sum);
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] arges) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		int v = Integer.parseInt(line);
		int[] m = new int[v];

		String line2 = sc.nextLine();
		String[] k = line2.split(" ");
		int[] y = new int[m.length];
		for (int i = 0; i < m.length; i++) {
			y[i] = Integer.parseInt(k[i]);
		}
		Arrays.sort(y);
		long sum = 0;
		for (int i = 0; i < y.length; i++) {
			sum += y[i];
		}
		System.out.print(y[0]);
		System.out.print(" " + y[y.length - 1]);
		System.out.println(" " + sum);
	}
} Main public static void main(String[] arges) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		int v = Integer.parseInt(line);
		int[] m = new int[v];

		String line2 = sc.nextLine();
		String[] k = line2.split(" ");
		int[] y = new int[m.length];
		for (int i = 0; i < m.length; i++) {
			y[i] = Integer.parseInt(k[i]);
		}
		Arrays.sort(y);
		long sum = 0;
		for (int i = 0; i < y.length; i++) {
			sum += y[i];
		}
		System.out.print(y[0]);
		System.out.print(" " + y[y.length - 1]);
		System.out.println(" " + sum);
	} main {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		int v = Integer.parseInt(line);
		int[] m = new int[v];

		String line2 = sc.nextLine();
		String[] k = line2.split(" ");
		int[] y = new int[m.length];
		for (int i = 0; i < m.length; i++) {
			y[i] = Integer.parseInt(k[i]);
		}
		Arrays.sort(y);
		long sum = 0;
		for (int i = 0; i < y.length; i++) {
			sum += y[i];
		}
		System.out.print(y[0]);
		System.out.print(" " + y[y.length - 1]);
		System.out.println(" " + sum);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc int v = Integer.parseInt(line); v Integer.parseInt(line) Integer.parseInt Integer line int[] m = new int[v]; m new int[v] v String line2 = sc.nextLine(); line2 sc.nextLine() sc.nextLine sc String[] k = line2.split(" "); k line2.split(" ") line2.split line2 " " int[] y = new int[m.length]; y new int[m.length] m.length m m.length for (int i = 0; i < m.length; i++) {
			y[i] = Integer.parseInt(k[i]);
		} int i = 0; int i = 0; i 0 i < m.length i m.length m m.length i++ i++ i {
			y[i] = Integer.parseInt(k[i]);
		} {
			y[i] = Integer.parseInt(k[i]);
		} y[i] = Integer.parseInt(k[i]) y[i] y i Integer.parseInt(k[i]) Integer.parseInt Integer k[i] k i Arrays.sort(y) Arrays.sort Arrays y long sum = 0; sum 0 for (int i = 0; i < y.length; i++) {
			sum += y[i];
		} int i = 0; int i = 0; i 0 i < y.length i y.length y y.length i++ i++ i {
			sum += y[i];
		} {
			sum += y[i];
		} sum += y[i] sum y[i] y i System.out.print(y[0]) System.out.print System.out System System.out y[0] y 0 System.out.print(" " + y[y.length - 1]) System.out.print System.out System System.out " " + y[y.length - 1] " " y[y.length - 1] y y.length - 1 y.length y y.length 1 System.out.println(" " + sum) System.out.println System.out System System.out " " + sum " " sum String[] arges arges public class Main {
	public static void main(String[] arges) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		int v = Integer.parseInt(line);
		int[] m = new int[v];

		String line2 = sc.nextLine();
		String[] k = line2.split(" ");
		int[] y = new int[m.length];
		for (int i = 0; i < m.length; i++) {
			y[i] = Integer.parseInt(k[i]);
		}
		Arrays.sort(y);
		long sum = 0;
		for (int i = 0; i < y.length; i++) {
			sum += y[i];
		}
		System.out.print(y[0]);
		System.out.print(" " + y[y.length - 1]);
		System.out.println(" " + sum);
	}
} public class Main {
	public static void main(String[] arges) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		int v = Integer.parseInt(line);
		int[] m = new int[v];

		String line2 = sc.nextLine();
		String[] k = line2.split(" ");
		int[] y = new int[m.length];
		for (int i = 0; i < m.length; i++) {
			y[i] = Integer.parseInt(k[i]);
		}
		Arrays.sort(y);
		long sum = 0;
		for (int i = 0; i < y.length; i++) {
			sum += y[i];
		}
		System.out.print(y[0]);
		System.out.print(" " + y[y.length - 1]);
		System.out.println(" " + sum);
	}
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] arges) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		int v = Integer.parseInt(line);
		int[] m = new int[v];

		String line2 = sc.nextLine();
		String[] k = line2.split(" ");
		int[] y = new int[m.length];
		for (int i = 0; i < m.length; i++) {
			y[i] = Integer.parseInt(k[i]);
		}
		Arrays.sort(y);
		long sum = 0;
		for (int i = 0; i < y.length; i++) {
			sum += y[i];
		}
		System.out.print(y[0]);
		System.out.print(" " + y[y.length - 1]);
		System.out.println(" " + sum);
	}
}