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

public class Main {
	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int number = scanner.nextInt();

		ArrayList<Integer> list = new ArrayList<Integer>();

		long total = 0;

		for (int i = 0; i < number; i++) {
			list.add(scanner.nextInt());
		}

		// ????????§???????????????
		Collections.sort(list);
		System.out.print(list.get(0) + " ");

		System.out.print(list.get(list.size() - 1) + " ");

		for (int i = 0; i < list.size(); i++) {
			total += list.get(i);
		}

		System.out.println(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 scanner = new Scanner(System.in);

		int number = scanner.nextInt();

		ArrayList<Integer> list = new ArrayList<Integer>();

		long total = 0;

		for (int i = 0; i < number; i++) {
			list.add(scanner.nextInt());
		}

		// ????????§???????????????
		Collections.sort(list);
		System.out.print(list.get(0) + " ");

		System.out.print(list.get(list.size() - 1) + " ");

		for (int i = 0; i < list.size(); i++) {
			total += list.get(i);
		}

		System.out.println(total);
	}
} Main public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int number = scanner.nextInt();

		ArrayList<Integer> list = new ArrayList<Integer>();

		long total = 0;

		for (int i = 0; i < number; i++) {
			list.add(scanner.nextInt());
		}

		// ????????§???????????????
		Collections.sort(list);
		System.out.print(list.get(0) + " ");

		System.out.print(list.get(list.size() - 1) + " ");

		for (int i = 0; i < list.size(); i++) {
			total += list.get(i);
		}

		System.out.println(total);
	} main {

		Scanner scanner = new Scanner(System.in);

		int number = scanner.nextInt();

		ArrayList<Integer> list = new ArrayList<Integer>();

		long total = 0;

		for (int i = 0; i < number; i++) {
			list.add(scanner.nextInt());
		}

		// ????????§???????????????
		Collections.sort(list);
		System.out.print(list.get(0) + " ");

		System.out.print(list.get(list.size() - 1) + " ");

		for (int i = 0; i < list.size(); i++) {
			total += list.get(i);
		}

		System.out.println(total);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int number = scanner.nextInt(); number scanner.nextInt() scanner.nextInt scanner ArrayList<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() long total = 0; total 0 for (int i = 0; i < number; i++) {
			list.add(scanner.nextInt());
		} int i = 0; int i = 0; i 0 i < number i number i++ i++ i {
			list.add(scanner.nextInt());
		} {
			list.add(scanner.nextInt());
		} list.add(scanner.nextInt()) list.add list scanner.nextInt() scanner.nextInt scanner Collections.sort(list) Collections.sort Collections list System.out.print(list.get(0) + " ") System.out.print System.out System System.out list.get(0) + " " list.get(0) list.get list 0 " " System.out.print(list.get(list.size() - 1) + " ") System.out.print System.out System System.out list.get(list.size() - 1) + " " list.get(list.size() - 1) list.get list list.size() - 1 list.size() list.size list 1 " " 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(total) System.out.println System.out System System.out total String[] args args public class Main {
	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int number = scanner.nextInt();

		ArrayList<Integer> list = new ArrayList<Integer>();

		long total = 0;

		for (int i = 0; i < number; i++) {
			list.add(scanner.nextInt());
		}

		// ????????§???????????????
		Collections.sort(list);
		System.out.print(list.get(0) + " ");

		System.out.print(list.get(list.size() - 1) + " ");

		for (int i = 0; i < list.size(); i++) {
			total += list.get(i);
		}

		System.out.println(total);
	}
} public class Main {
	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int number = scanner.nextInt();

		ArrayList<Integer> list = new ArrayList<Integer>();

		long total = 0;

		for (int i = 0; i < number; i++) {
			list.add(scanner.nextInt());
		}

		// ????????§???????????????
		Collections.sort(list);
		System.out.print(list.get(0) + " ");

		System.out.print(list.get(list.size() - 1) + " ");

		for (int i = 0; i < list.size(); i++) {
			total += list.get(i);
		}

		System.out.println(total);
	}
} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int number = scanner.nextInt();

		ArrayList<Integer> list = new ArrayList<Integer>();

		long total = 0;

		for (int i = 0; i < number; i++) {
			list.add(scanner.nextInt());
		}

		// ????????§???????????????
		Collections.sort(list);
		System.out.print(list.get(0) + " ");

		System.out.print(list.get(list.size() - 1) + " ");

		for (int i = 0; i < list.size(); i++) {
			total += list.get(i);
		}

		System.out.println(total);
	}
}