import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main{
	public static void main(String[]args)throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		int n=0;
		String[] arr;
		int[] array;
		int min=0;
		int max=0;
		long sum=0;
		while((str=br.readLine())!=null){
			if(n == 0){
				n=Integer.parseInt(str);
				continue;
			}
			arr=str.split(" ");
			array = new int[n];
			for(int i=0;i<n;i++){
				array[i]=Integer.parseInt(arr[i]);
				sum+=array[i];
			}
			for(int i=0;i<n;i++){
				for(int j=i+1;j<n;j++) {
					if(array[i] <= array[j]);
					else{
						int temp = array[i];
						array[i]=array[j];
						array[j]=temp;
					}
				}
			}

			min=array[0];
			max=array[n-1];
			System.out.println(min+" "+max+" "+sum);
			
		}		
		br.close();
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main{
	public static void main(String[]args)throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		int n=0;
		String[] arr;
		int[] array;
		int min=0;
		int max=0;
		long sum=0;
		while((str=br.readLine())!=null){
			if(n == 0){
				n=Integer.parseInt(str);
				continue;
			}
			arr=str.split(" ");
			array = new int[n];
			for(int i=0;i<n;i++){
				array[i]=Integer.parseInt(arr[i]);
				sum+=array[i];
			}
			for(int i=0;i<n;i++){
				for(int j=i+1;j<n;j++) {
					if(array[i] <= array[j]);
					else{
						int temp = array[i];
						array[i]=array[j];
						array[j]=temp;
					}
				}
			}

			min=array[0];
			max=array[n-1];
			System.out.println(min+" "+max+" "+sum);
			
		}		
		br.close();
	}
} Main public static void main(String[]args)throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		int n=0;
		String[] arr;
		int[] array;
		int min=0;
		int max=0;
		long sum=0;
		while((str=br.readLine())!=null){
			if(n == 0){
				n=Integer.parseInt(str);
				continue;
			}
			arr=str.split(" ");
			array = new int[n];
			for(int i=0;i<n;i++){
				array[i]=Integer.parseInt(arr[i]);
				sum+=array[i];
			}
			for(int i=0;i<n;i++){
				for(int j=i+1;j<n;j++) {
					if(array[i] <= array[j]);
					else{
						int temp = array[i];
						array[i]=array[j];
						array[j]=temp;
					}
				}
			}

			min=array[0];
			max=array[n-1];
			System.out.println(min+" "+max+" "+sum);
			
		}		
		br.close();
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		int n=0;
		String[] arr;
		int[] array;
		int min=0;
		int max=0;
		long sum=0;
		while((str=br.readLine())!=null){
			if(n == 0){
				n=Integer.parseInt(str);
				continue;
			}
			arr=str.split(" ");
			array = new int[n];
			for(int i=0;i<n;i++){
				array[i]=Integer.parseInt(arr[i]);
				sum+=array[i];
			}
			for(int i=0;i<n;i++){
				for(int j=i+1;j<n;j++) {
					if(array[i] <= array[j]);
					else{
						int temp = array[i];
						array[i]=array[j];
						array[j]=temp;
					}
				}
			}

			min=array[0];
			max=array[n-1];
			System.out.println(min+" "+max+" "+sum);
			
		}		
		br.close();
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str; str int n=0; n 0 String[] arr; arr int[] array; array int min=0; min 0 int max=0; max 0 long sum=0; sum 0 while((str=br.readLine())!=null){
			if(n == 0){
				n=Integer.parseInt(str);
				continue;
			}
			arr=str.split(" ");
			array = new int[n];
			for(int i=0;i<n;i++){
				array[i]=Integer.parseInt(arr[i]);
				sum+=array[i];
			}
			for(int i=0;i<n;i++){
				for(int j=i+1;j<n;j++) {
					if(array[i] <= array[j]);
					else{
						int temp = array[i];
						array[i]=array[j];
						array[j]=temp;
					}
				}
			}

			min=array[0];
			max=array[n-1];
			System.out.println(min+" "+max+" "+sum);
			
		} (str=br.readLine())!=null (str=br.readLine()) str br.readLine() br.readLine br null {
			if(n == 0){
				n=Integer.parseInt(str);
				continue;
			}
			arr=str.split(" ");
			array = new int[n];
			for(int i=0;i<n;i++){
				array[i]=Integer.parseInt(arr[i]);
				sum+=array[i];
			}
			for(int i=0;i<n;i++){
				for(int j=i+1;j<n;j++) {
					if(array[i] <= array[j]);
					else{
						int temp = array[i];
						array[i]=array[j];
						array[j]=temp;
					}
				}
			}

			min=array[0];
			max=array[n-1];
			System.out.println(min+" "+max+" "+sum);
			
		} if(n == 0){
				n=Integer.parseInt(str);
				continue;
			} n == 0 n 0 {
				n=Integer.parseInt(str);
				continue;
			} n=Integer.parseInt(str) n Integer.parseInt(str) Integer.parseInt Integer str continue; arr=str.split(" ") arr str.split(" ") str.split str " " array = new int[n] array new int[n] n for(int i=0;i<n;i++){
				array[i]=Integer.parseInt(arr[i]);
				sum+=array[i];
			} int i=0; int i=0; i 0 i<n i n i++ i++ i {
				array[i]=Integer.parseInt(arr[i]);
				sum+=array[i];
			} {
				array[i]=Integer.parseInt(arr[i]);
				sum+=array[i];
			} array[i]=Integer.parseInt(arr[i]) array[i] array i Integer.parseInt(arr[i]) Integer.parseInt Integer arr[i] arr i sum+=array[i] sum array[i] array i for(int i=0;i<n;i++){
				for(int j=i+1;j<n;j++) {
					if(array[i] <= array[j]);
					else{
						int temp = array[i];
						array[i]=array[j];
						array[j]=temp;
					}
				}
			} int i=0; int i=0; i 0 i<n i n i++ i++ i {
				for(int j=i+1;j<n;j++) {
					if(array[i] <= array[j]);
					else{
						int temp = array[i];
						array[i]=array[j];
						array[j]=temp;
					}
				}
			} {
				for(int j=i+1;j<n;j++) {
					if(array[i] <= array[j]);
					else{
						int temp = array[i];
						array[i]=array[j];
						array[j]=temp;
					}
				}
			} for(int j=i+1;j<n;j++) {
					if(array[i] <= array[j]);
					else{
						int temp = array[i];
						array[i]=array[j];
						array[j]=temp;
					}
				} int j=i+1; int j=i+1; j i+1 i 1 j<n j n j++ j++ j {
					if(array[i] <= array[j]);
					else{
						int temp = array[i];
						array[i]=array[j];
						array[j]=temp;
					}
				} {
					if(array[i] <= array[j]);
					else{
						int temp = array[i];
						array[i]=array[j];
						array[j]=temp;
					}
				} if(array[i] <= array[j]);
					else{
						int temp = array[i];
						array[i]=array[j];
						array[j]=temp;
					} array[i] <= array[j] array[i] array i array[j] array j {
						int temp = array[i];
						array[i]=array[j];
						array[j]=temp;
					} int temp = array[i]; temp array[i] array i array[i]=array[j] array[i] array i array[j] array j array[j]=temp array[j] array j temp min=array[0] min array[0] array 0 max=array[n-1] max array[n-1] array n-1 n 1 System.out.println(min+" "+max+" "+sum) System.out.println System.out System System.out min+" "+max+" "+sum " " max min+" "+max+" "+sum min " " max " " sum br.close() br.close br String[]args args public class Main{
	public static void main(String[]args)throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		int n=0;
		String[] arr;
		int[] array;
		int min=0;
		int max=0;
		long sum=0;
		while((str=br.readLine())!=null){
			if(n == 0){
				n=Integer.parseInt(str);
				continue;
			}
			arr=str.split(" ");
			array = new int[n];
			for(int i=0;i<n;i++){
				array[i]=Integer.parseInt(arr[i]);
				sum+=array[i];
			}
			for(int i=0;i<n;i++){
				for(int j=i+1;j<n;j++) {
					if(array[i] <= array[j]);
					else{
						int temp = array[i];
						array[i]=array[j];
						array[j]=temp;
					}
				}
			}

			min=array[0];
			max=array[n-1];
			System.out.println(min+" "+max+" "+sum);
			
		}		
		br.close();
	}
} public class Main{
	public static void main(String[]args)throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		int n=0;
		String[] arr;
		int[] array;
		int min=0;
		int max=0;
		long sum=0;
		while((str=br.readLine())!=null){
			if(n == 0){
				n=Integer.parseInt(str);
				continue;
			}
			arr=str.split(" ");
			array = new int[n];
			for(int i=0;i<n;i++){
				array[i]=Integer.parseInt(arr[i]);
				sum+=array[i];
			}
			for(int i=0;i<n;i++){
				for(int j=i+1;j<n;j++) {
					if(array[i] <= array[j]);
					else{
						int temp = array[i];
						array[i]=array[j];
						array[j]=temp;
					}
				}
			}

			min=array[0];
			max=array[n-1];
			System.out.println(min+" "+max+" "+sum);
			
		}		
		br.close();
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main{
	public static void main(String[]args)throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		int n=0;
		String[] arr;
		int[] array;
		int min=0;
		int max=0;
		long sum=0;
		while((str=br.readLine())!=null){
			if(n == 0){
				n=Integer.parseInt(str);
				continue;
			}
			arr=str.split(" ");
			array = new int[n];
			for(int i=0;i<n;i++){
				array[i]=Integer.parseInt(arr[i]);
				sum+=array[i];
			}
			for(int i=0;i<n;i++){
				for(int j=i+1;j<n;j++) {
					if(array[i] <= array[j]);
					else{
						int temp = array[i];
						array[i]=array[j];
						array[j]=temp;
					}
				}
			}

			min=array[0];
			max=array[n-1];
			System.out.println(min+" "+max+" "+sum);
			
		}		
		br.close();
	}
}