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[] set1 = line2.split(" ");
		int[] set = new int[n];
		long sum = 0;

		for (int i = 0; i < n; i++) {
			set[i] = Integer.parseInt(set1[i]);
			sum += set[i];
		}

		Arrays.sort(set);

		System.out.print(set[0]);
		System.out.print(" ");
		System.out.print(set[n-1]);
		System.out.print(" ");
		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[] args) {
		Scanner sc = new Scanner(System.in);
		String line1 = sc.nextLine();
		int n = Integer.parseInt(line1);

		String line2 = sc.nextLine();
		String[] set1 = line2.split(" ");
		int[] set = new int[n];
		long sum = 0;

		for (int i = 0; i < n; i++) {
			set[i] = Integer.parseInt(set1[i]);
			sum += set[i];
		}

		Arrays.sort(set);

		System.out.print(set[0]);
		System.out.print(" ");
		System.out.print(set[n-1]);
		System.out.print(" ");
		System.out.println(sum);
		
	}

} 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[] set1 = line2.split(" ");
		int[] set = new int[n];
		long sum = 0;

		for (int i = 0; i < n; i++) {
			set[i] = Integer.parseInt(set1[i]);
			sum += set[i];
		}

		Arrays.sort(set);

		System.out.print(set[0]);
		System.out.print(" ");
		System.out.print(set[n-1]);
		System.out.print(" ");
		System.out.println(sum);
		
	} main {
		Scanner sc = new Scanner(System.in);
		String line1 = sc.nextLine();
		int n = Integer.parseInt(line1);

		String line2 = sc.nextLine();
		String[] set1 = line2.split(" ");
		int[] set = new int[n];
		long sum = 0;

		for (int i = 0; i < n; i++) {
			set[i] = Integer.parseInt(set1[i]);
			sum += set[i];
		}

		Arrays.sort(set);

		System.out.print(set[0]);
		System.out.print(" ");
		System.out.print(set[n-1]);
		System.out.print(" ");
		System.out.println(sum);
		
	} 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[] set1 = line2.split(" "); set1 line2.split(" ") line2.split line2 " " int[] set = new int[n]; set new int[n] n long sum = 0; sum 0 for (int i = 0; i < n; i++) {
			set[i] = Integer.parseInt(set1[i]);
			sum += set[i];
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			set[i] = Integer.parseInt(set1[i]);
			sum += set[i];
		} {
			set[i] = Integer.parseInt(set1[i]);
			sum += set[i];
		} set[i] = Integer.parseInt(set1[i]) set[i] set i Integer.parseInt(set1[i]) Integer.parseInt Integer set1[i] set1 i sum += set[i] sum set[i] set i Arrays.sort(set) Arrays.sort Arrays set System.out.print(set[0]) System.out.print System.out System System.out set[0] set 0 System.out.print(" ") System.out.print System.out System System.out " " System.out.print(set[n-1]) System.out.print System.out System System.out set[n-1] set n-1 n 1 System.out.print(" ") System.out.print System.out System System.out " " System.out.println(sum) System.out.println System.out System System.out sum 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[] set1 = line2.split(" ");
		int[] set = new int[n];
		long sum = 0;

		for (int i = 0; i < n; i++) {
			set[i] = Integer.parseInt(set1[i]);
			sum += set[i];
		}

		Arrays.sort(set);

		System.out.print(set[0]);
		System.out.print(" ");
		System.out.print(set[n-1]);
		System.out.print(" ");
		System.out.println(sum);
		
	}

} 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[] set1 = line2.split(" ");
		int[] set = new int[n];
		long sum = 0;

		for (int i = 0; i < n; i++) {
			set[i] = Integer.parseInt(set1[i]);
			sum += set[i];
		}

		Arrays.sort(set);

		System.out.print(set[0]);
		System.out.print(" ");
		System.out.print(set[n-1]);
		System.out.print(" ");
		System.out.println(sum);
		
	}

} 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[] set1 = line2.split(" ");
		int[] set = new int[n];
		long sum = 0;

		for (int i = 0; i < n; i++) {
			set[i] = Integer.parseInt(set1[i]);
			sum += set[i];
		}

		Arrays.sort(set);

		System.out.print(set[0]);
		System.out.print(" ");
		System.out.print(set[n-1]);
		System.out.print(" ");
		System.out.println(sum);
		
	}

}