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

public class Main {

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

		String line1 = sc.nextLine();
		int n = Integer.parseInt(line1);

		String line2 = sc.nextLine();
		String[] array = line2.split(" ");

		long[] ai = new long[array.length];
		for (int i = 0; i < ai.length; i++) {
			ai[i] = Integer.parseInt(array[i]);
		}

		Arrays.sort(ai);
		long A = ai[0];
		long B = ai[n - 1];

		long C = 0;
		for (int i = 0; i < ai.length; i++) {
			C += ai[i];

		}

		System.out.println(A + " " + B + " " + C);

	}

} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

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

		String line1 = sc.nextLine();
		int n = Integer.parseInt(line1);

		String line2 = sc.nextLine();
		String[] array = line2.split(" ");

		long[] ai = new long[array.length];
		for (int i = 0; i < ai.length; i++) {
			ai[i] = Integer.parseInt(array[i]);
		}

		Arrays.sort(ai);
		long A = ai[0];
		long B = ai[n - 1];

		long C = 0;
		for (int i = 0; i < ai.length; i++) {
			C += ai[i];

		}

		System.out.println(A + " " + B + " " + C);

	}

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

		String line1 = sc.nextLine();
		int n = Integer.parseInt(line1);

		String line2 = sc.nextLine();
		String[] array = line2.split(" ");

		long[] ai = new long[array.length];
		for (int i = 0; i < ai.length; i++) {
			ai[i] = Integer.parseInt(array[i]);
		}

		Arrays.sort(ai);
		long A = ai[0];
		long B = ai[n - 1];

		long C = 0;
		for (int i = 0; i < ai.length; i++) {
			C += ai[i];

		}

		System.out.println(A + " " + B + " " + C);

	} main {
		Scanner sc = new Scanner(System.in);

		String line1 = sc.nextLine();
		int n = Integer.parseInt(line1);

		String line2 = sc.nextLine();
		String[] array = line2.split(" ");

		long[] ai = new long[array.length];
		for (int i = 0; i < ai.length; i++) {
			ai[i] = Integer.parseInt(array[i]);
		}

		Arrays.sort(ai);
		long A = ai[0];
		long B = ai[n - 1];

		long C = 0;
		for (int i = 0; i < ai.length; i++) {
			C += ai[i];

		}

		System.out.println(A + " " + B + " " + C);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String line1 = sc.nextLine(); line1 sc.nextLine() sc.nextLine sc int n = Integer.parseInt(line1); n Integer.parseInt(line1) Integer.parseInt Integer line1 String line2 = sc.nextLine(); line2 sc.nextLine() sc.nextLine sc String[] array = line2.split(" "); array line2.split(" ") line2.split line2 " " long[] ai = new long[array.length]; ai new long[array.length] array.length array array.length for (int i = 0; i < ai.length; i++) {
			ai[i] = Integer.parseInt(array[i]);
		} int i = 0; int i = 0; i 0 i < ai.length i ai.length ai ai.length i++ i++ i {
			ai[i] = Integer.parseInt(array[i]);
		} {
			ai[i] = Integer.parseInt(array[i]);
		} ai[i] = Integer.parseInt(array[i]) ai[i] ai i Integer.parseInt(array[i]) Integer.parseInt Integer array[i] array i Arrays.sort(ai) Arrays.sort Arrays ai long A = ai[0]; A ai[0] ai 0 long B = ai[n - 1]; B ai[n - 1] ai n - 1 n 1 long C = 0; C 0 for (int i = 0; i < ai.length; i++) {
			C += ai[i];

		} int i = 0; int i = 0; i 0 i < ai.length i ai.length ai ai.length i++ i++ i {
			C += ai[i];

		} {
			C += ai[i];

		} C += ai[i] C ai[i] ai i System.out.println(A + " " + B + " " + C) System.out.println System.out System System.out A + " " + B + " " + C " " B A + " " + B + " " + C A " " B " " C String[] args args public class Main {

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

		String line1 = sc.nextLine();
		int n = Integer.parseInt(line1);

		String line2 = sc.nextLine();
		String[] array = line2.split(" ");

		long[] ai = new long[array.length];
		for (int i = 0; i < ai.length; i++) {
			ai[i] = Integer.parseInt(array[i]);
		}

		Arrays.sort(ai);
		long A = ai[0];
		long B = ai[n - 1];

		long C = 0;
		for (int i = 0; i < ai.length; i++) {
			C += ai[i];

		}

		System.out.println(A + " " + B + " " + C);

	}

} public class Main {

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

		String line1 = sc.nextLine();
		int n = Integer.parseInt(line1);

		String line2 = sc.nextLine();
		String[] array = line2.split(" ");

		long[] ai = new long[array.length];
		for (int i = 0; i < ai.length; i++) {
			ai[i] = Integer.parseInt(array[i]);
		}

		Arrays.sort(ai);
		long A = ai[0];
		long B = ai[n - 1];

		long C = 0;
		for (int i = 0; i < ai.length; i++) {
			C += ai[i];

		}

		System.out.println(A + " " + B + " " + C);

	}

} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {

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

		String line1 = sc.nextLine();
		int n = Integer.parseInt(line1);

		String line2 = sc.nextLine();
		String[] array = line2.split(" ");

		long[] ai = new long[array.length];
		for (int i = 0; i < ai.length; i++) {
			ai[i] = Integer.parseInt(array[i]);
		}

		Arrays.sort(ai);
		long A = ai[0];
		long B = ai[n - 1];

		long C = 0;
		for (int i = 0; i < ai.length; i++) {
			C += ai[i];

		}

		System.out.println(A + " " + B + " " + C);

	}

}