import java.io.*;
public class Main {
	public static void main(String[] args){
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		try{
			String line1 = reader.readLine();
			int n = Integer.parseInt(line1);//1stLine
			String line2 = reader.readLine();//2ndLine
			String[] sarray = line2.split(" ", -1);
			int[] num = new int[n];
			for(int i = 0; i < n; i++){
				num[i] = Integer.parseInt(sarray[i]);
			}
			
			int min = 0;//min number
			int p = 0;
			while(min < n - 1 && p < n - 1){
				p++;
				if(num[min] > num[p]){
					min = p;
				}
			}
			
			int max = 0;//max number
			int q = 0;
			while(max < n - 1 && q < n - 1){
				q++;
				if(num[max] < num[q]){
					max = q;
				}
			}
			
			long sum[] = new long[n + 1]; //sum long
			long value[] = new long[n];
			for(int j = 0; j < n; j++){
				value[j] = num[j]; //int to long
			}
			sum[0] = 0;
			for(int k = 1; k <= n; k++){
				sum[k] = value[k - 1] + sum[k - 1];
			}
			
			System.out.println(num[min] + " " + num[max] + " " + sum[n]);
		} catch (IOException e) {
          System.out.println(e);
        } catch (NumberFormatException e) {
          System.out.println("error");
        }
    }
} import java.io.*; io.* java public class Main {
	public static void main(String[] args){
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		try{
			String line1 = reader.readLine();
			int n = Integer.parseInt(line1);//1stLine
			String line2 = reader.readLine();//2ndLine
			String[] sarray = line2.split(" ", -1);
			int[] num = new int[n];
			for(int i = 0; i < n; i++){
				num[i] = Integer.parseInt(sarray[i]);
			}
			
			int min = 0;//min number
			int p = 0;
			while(min < n - 1 && p < n - 1){
				p++;
				if(num[min] > num[p]){
					min = p;
				}
			}
			
			int max = 0;//max number
			int q = 0;
			while(max < n - 1 && q < n - 1){
				q++;
				if(num[max] < num[q]){
					max = q;
				}
			}
			
			long sum[] = new long[n + 1]; //sum long
			long value[] = new long[n];
			for(int j = 0; j < n; j++){
				value[j] = num[j]; //int to long
			}
			sum[0] = 0;
			for(int k = 1; k <= n; k++){
				sum[k] = value[k - 1] + sum[k - 1];
			}
			
			System.out.println(num[min] + " " + num[max] + " " + sum[n]);
		} catch (IOException e) {
          System.out.println(e);
        } catch (NumberFormatException e) {
          System.out.println("error");
        }
    }
} Main public static void main(String[] args){
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		try{
			String line1 = reader.readLine();
			int n = Integer.parseInt(line1);//1stLine
			String line2 = reader.readLine();//2ndLine
			String[] sarray = line2.split(" ", -1);
			int[] num = new int[n];
			for(int i = 0; i < n; i++){
				num[i] = Integer.parseInt(sarray[i]);
			}
			
			int min = 0;//min number
			int p = 0;
			while(min < n - 1 && p < n - 1){
				p++;
				if(num[min] > num[p]){
					min = p;
				}
			}
			
			int max = 0;//max number
			int q = 0;
			while(max < n - 1 && q < n - 1){
				q++;
				if(num[max] < num[q]){
					max = q;
				}
			}
			
			long sum[] = new long[n + 1]; //sum long
			long value[] = new long[n];
			for(int j = 0; j < n; j++){
				value[j] = num[j]; //int to long
			}
			sum[0] = 0;
			for(int k = 1; k <= n; k++){
				sum[k] = value[k - 1] + sum[k - 1];
			}
			
			System.out.println(num[min] + " " + num[max] + " " + sum[n]);
		} catch (IOException e) {
          System.out.println(e);
        } catch (NumberFormatException e) {
          System.out.println("error");
        }
    } main {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		try{
			String line1 = reader.readLine();
			int n = Integer.parseInt(line1);//1stLine
			String line2 = reader.readLine();//2ndLine
			String[] sarray = line2.split(" ", -1);
			int[] num = new int[n];
			for(int i = 0; i < n; i++){
				num[i] = Integer.parseInt(sarray[i]);
			}
			
			int min = 0;//min number
			int p = 0;
			while(min < n - 1 && p < n - 1){
				p++;
				if(num[min] > num[p]){
					min = p;
				}
			}
			
			int max = 0;//max number
			int q = 0;
			while(max < n - 1 && q < n - 1){
				q++;
				if(num[max] < num[q]){
					max = q;
				}
			}
			
			long sum[] = new long[n + 1]; //sum long
			long value[] = new long[n];
			for(int j = 0; j < n; j++){
				value[j] = num[j]; //int to long
			}
			sum[0] = 0;
			for(int k = 1; k <= n; k++){
				sum[k] = value[k - 1] + sum[k - 1];
			}
			
			System.out.println(num[min] + " " + num[max] + " " + sum[n]);
		} catch (IOException e) {
          System.out.println(e);
        } catch (NumberFormatException e) {
          System.out.println("error");
        }
    } BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) try{
			String line1 = reader.readLine();
			int n = Integer.parseInt(line1);//1stLine
			String line2 = reader.readLine();//2ndLine
			String[] sarray = line2.split(" ", -1);
			int[] num = new int[n];
			for(int i = 0; i < n; i++){
				num[i] = Integer.parseInt(sarray[i]);
			}
			
			int min = 0;//min number
			int p = 0;
			while(min < n - 1 && p < n - 1){
				p++;
				if(num[min] > num[p]){
					min = p;
				}
			}
			
			int max = 0;//max number
			int q = 0;
			while(max < n - 1 && q < n - 1){
				q++;
				if(num[max] < num[q]){
					max = q;
				}
			}
			
			long sum[] = new long[n + 1]; //sum long
			long value[] = new long[n];
			for(int j = 0; j < n; j++){
				value[j] = num[j]; //int to long
			}
			sum[0] = 0;
			for(int k = 1; k <= n; k++){
				sum[k] = value[k - 1] + sum[k - 1];
			}
			
			System.out.println(num[min] + " " + num[max] + " " + sum[n]);
		} catch (IOException e) {
          System.out.println(e);
        } catch (NumberFormatException e) {
          System.out.println("error");
        } catch (IOException e) {
          System.out.println(e);
        } IOException e {
          System.out.println(e);
        } System.out.println(e) System.out.println System.out System System.out e catch (NumberFormatException e) {
          System.out.println("error");
        } NumberFormatException e {
          System.out.println("error");
        } System.out.println("error") System.out.println System.out System System.out "error" {
			String line1 = reader.readLine();
			int n = Integer.parseInt(line1);//1stLine
			String line2 = reader.readLine();//2ndLine
			String[] sarray = line2.split(" ", -1);
			int[] num = new int[n];
			for(int i = 0; i < n; i++){
				num[i] = Integer.parseInt(sarray[i]);
			}
			
			int min = 0;//min number
			int p = 0;
			while(min < n - 1 && p < n - 1){
				p++;
				if(num[min] > num[p]){
					min = p;
				}
			}
			
			int max = 0;//max number
			int q = 0;
			while(max < n - 1 && q < n - 1){
				q++;
				if(num[max] < num[q]){
					max = q;
				}
			}
			
			long sum[] = new long[n + 1]; //sum long
			long value[] = new long[n];
			for(int j = 0; j < n; j++){
				value[j] = num[j]; //int to long
			}
			sum[0] = 0;
			for(int k = 1; k <= n; k++){
				sum[k] = value[k - 1] + sum[k - 1];
			}
			
			System.out.println(num[min] + " " + num[max] + " " + sum[n]);
		} String line1 = reader.readLine(); line1 reader.readLine() reader.readLine reader int n = Integer.parseInt(line1); n Integer.parseInt(line1) Integer.parseInt Integer line1 String line2 = reader.readLine(); line2 reader.readLine() reader.readLine reader String[] sarray = line2.split(" ", -1); sarray line2.split(" ", -1) line2.split line2 " " -1 1 int[] num = new int[n]; num new int[n] n for(int i = 0; i < n; i++){
				num[i] = Integer.parseInt(sarray[i]);
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				num[i] = Integer.parseInt(sarray[i]);
			} {
				num[i] = Integer.parseInt(sarray[i]);
			} num[i] = Integer.parseInt(sarray[i]) num[i] num i Integer.parseInt(sarray[i]) Integer.parseInt Integer sarray[i] sarray i int min = 0; min 0 int p = 0; p 0 while(min < n - 1 && p < n - 1){
				p++;
				if(num[min] > num[p]){
					min = p;
				}
			} min < n - 1 && p < n - 1 min < n - 1 min n - 1 n 1 p < n - 1 p n - 1 n 1 {
				p++;
				if(num[min] > num[p]){
					min = p;
				}
			} p++ p if(num[min] > num[p]){
					min = p;
				} num[min] > num[p] num[min] num min num[p] num p {
					min = p;
				} min = p min p int max = 0; max 0 int q = 0; q 0 while(max < n - 1 && q < n - 1){
				q++;
				if(num[max] < num[q]){
					max = q;
				}
			} max < n - 1 && q < n - 1 max < n - 1 max n - 1 n 1 q < n - 1 q n - 1 n 1 {
				q++;
				if(num[max] < num[q]){
					max = q;
				}
			} q++ q if(num[max] < num[q]){
					max = q;
				} num[max] < num[q] num[max] num max num[q] num q {
					max = q;
				} max = q max q long sum[] = new long[n + 1]; sum new long[n + 1] n + 1 n 1 long value[] = new long[n]; value new long[n] n for(int j = 0; j < n; j++){
				value[j] = num[j]; //int to long
			} int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
				value[j] = num[j]; //int to long
			} {
				value[j] = num[j]; //int to long
			} value[j] = num[j] value[j] value j num[j] num j sum[0] = 0 sum[0] sum 0 0 for(int k = 1; k <= n; k++){
				sum[k] = value[k - 1] + sum[k - 1];
			} int k = 1; int k = 1; k 1 k <= n k n k++ k++ k {
				sum[k] = value[k - 1] + sum[k - 1];
			} {
				sum[k] = value[k - 1] + sum[k - 1];
			} sum[k] = value[k - 1] + sum[k - 1] sum[k] sum k value[k - 1] + sum[k - 1] value[k - 1] value k - 1 k 1 sum[k - 1] sum k - 1 k 1 System.out.println(num[min] + " " + num[max] + " " + sum[n]) System.out.println System.out System System.out num[min] + " " + num[max] + " " + sum[n] " " num[max] num[min] + " " + num[max] + " " + sum[n] num[min] num min " " num[max] num max " " sum[n] sum n String[] args args public class Main {
	public static void main(String[] args){
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		try{
			String line1 = reader.readLine();
			int n = Integer.parseInt(line1);//1stLine
			String line2 = reader.readLine();//2ndLine
			String[] sarray = line2.split(" ", -1);
			int[] num = new int[n];
			for(int i = 0; i < n; i++){
				num[i] = Integer.parseInt(sarray[i]);
			}
			
			int min = 0;//min number
			int p = 0;
			while(min < n - 1 && p < n - 1){
				p++;
				if(num[min] > num[p]){
					min = p;
				}
			}
			
			int max = 0;//max number
			int q = 0;
			while(max < n - 1 && q < n - 1){
				q++;
				if(num[max] < num[q]){
					max = q;
				}
			}
			
			long sum[] = new long[n + 1]; //sum long
			long value[] = new long[n];
			for(int j = 0; j < n; j++){
				value[j] = num[j]; //int to long
			}
			sum[0] = 0;
			for(int k = 1; k <= n; k++){
				sum[k] = value[k - 1] + sum[k - 1];
			}
			
			System.out.println(num[min] + " " + num[max] + " " + sum[n]);
		} catch (IOException e) {
          System.out.println(e);
        } catch (NumberFormatException e) {
          System.out.println("error");
        }
    }
} public class Main {
	public static void main(String[] args){
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		try{
			String line1 = reader.readLine();
			int n = Integer.parseInt(line1);//1stLine
			String line2 = reader.readLine();//2ndLine
			String[] sarray = line2.split(" ", -1);
			int[] num = new int[n];
			for(int i = 0; i < n; i++){
				num[i] = Integer.parseInt(sarray[i]);
			}
			
			int min = 0;//min number
			int p = 0;
			while(min < n - 1 && p < n - 1){
				p++;
				if(num[min] > num[p]){
					min = p;
				}
			}
			
			int max = 0;//max number
			int q = 0;
			while(max < n - 1 && q < n - 1){
				q++;
				if(num[max] < num[q]){
					max = q;
				}
			}
			
			long sum[] = new long[n + 1]; //sum long
			long value[] = new long[n];
			for(int j = 0; j < n; j++){
				value[j] = num[j]; //int to long
			}
			sum[0] = 0;
			for(int k = 1; k <= n; k++){
				sum[k] = value[k - 1] + sum[k - 1];
			}
			
			System.out.println(num[min] + " " + num[max] + " " + sum[n]);
		} catch (IOException e) {
          System.out.println(e);
        } catch (NumberFormatException e) {
          System.out.println("error");
        }
    }
} Main
import java.io.*;
public class Main {
	public static void main(String[] args){
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		try{
			String line1 = reader.readLine();
			int n = Integer.parseInt(line1);//1stLine
			String line2 = reader.readLine();//2ndLine
			String[] sarray = line2.split(" ", -1);
			int[] num = new int[n];
			for(int i = 0; i < n; i++){
				num[i] = Integer.parseInt(sarray[i]);
			}
			
			int min = 0;//min number
			int p = 0;
			while(min < n - 1 && p < n - 1){
				p++;
				if(num[min] > num[p]){
					min = p;
				}
			}
			
			int max = 0;//max number
			int q = 0;
			while(max < n - 1 && q < n - 1){
				q++;
				if(num[max] < num[q]){
					max = q;
				}
			}
			
			long sum[] = new long[n + 1]; //sum long
			long value[] = new long[n];
			for(int j = 0; j < n; j++){
				value[j] = num[j]; //int to long
			}
			sum[0] = 0;
			for(int k = 1; k <= n; k++){
				sum[k] = value[k - 1] + sum[k - 1];
			}
			
			System.out.println(num[min] + " " + num[max] + " " + sum[n]);
		} catch (IOException e) {
          System.out.println(e);
        } catch (NumberFormatException e) {
          System.out.println("error");
        }
    }
}