import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    		String kosu=br.readLine();
    		int nako=Integer.parseInt(kosu);
        	String strArr[] = br.readLine().split(" ");
        	int[] a=new int[nako];

        	for(int j=0; j<nako; j++){
        		a[j]=Integer.parseInt(strArr[j]);
        	}

        	for(int i=0;i<nako-1;i++){
        	      for(int j=nako-1;j>i;j--){

        		if(a[j]<a[j-1]){
        		  int t=a[j];
        		  a[j]=a[j-1];
        		  a[j-1]=t;
        		}
        	  }
        	}

        	long sum=0;
        	for(int i=0; i<nako; i++){
        		sum+=a[i];
        	}

        	System.out.println(a[0]+" "+a[nako-1]+" "+sum);

    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io class Main {
    public static void main(String[] args) throws IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    		String kosu=br.readLine();
    		int nako=Integer.parseInt(kosu);
        	String strArr[] = br.readLine().split(" ");
        	int[] a=new int[nako];

        	for(int j=0; j<nako; j++){
        		a[j]=Integer.parseInt(strArr[j]);
        	}

        	for(int i=0;i<nako-1;i++){
        	      for(int j=nako-1;j>i;j--){

        		if(a[j]<a[j-1]){
        		  int t=a[j];
        		  a[j]=a[j-1];
        		  a[j-1]=t;
        		}
        	  }
        	}

        	long sum=0;
        	for(int i=0; i<nako; i++){
        		sum+=a[i];
        	}

        	System.out.println(a[0]+" "+a[nako-1]+" "+sum);

    }
} Main public static void main(String[] args) throws IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    		String kosu=br.readLine();
    		int nako=Integer.parseInt(kosu);
        	String strArr[] = br.readLine().split(" ");
        	int[] a=new int[nako];

        	for(int j=0; j<nako; j++){
        		a[j]=Integer.parseInt(strArr[j]);
        	}

        	for(int i=0;i<nako-1;i++){
        	      for(int j=nako-1;j>i;j--){

        		if(a[j]<a[j-1]){
        		  int t=a[j];
        		  a[j]=a[j-1];
        		  a[j-1]=t;
        		}
        	  }
        	}

        	long sum=0;
        	for(int i=0; i<nako; i++){
        		sum+=a[i];
        	}

        	System.out.println(a[0]+" "+a[nako-1]+" "+sum);

    } main {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    		String kosu=br.readLine();
    		int nako=Integer.parseInt(kosu);
        	String strArr[] = br.readLine().split(" ");
        	int[] a=new int[nako];

        	for(int j=0; j<nako; j++){
        		a[j]=Integer.parseInt(strArr[j]);
        	}

        	for(int i=0;i<nako-1;i++){
        	      for(int j=nako-1;j>i;j--){

        		if(a[j]<a[j-1]){
        		  int t=a[j];
        		  a[j]=a[j-1];
        		  a[j-1]=t;
        		}
        	  }
        	}

        	long sum=0;
        	for(int i=0; i<nako; i++){
        		sum+=a[i];
        	}

        	System.out.println(a[0]+" "+a[nako-1]+" "+sum);

    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String kosu=br.readLine(); kosu br.readLine() br.readLine br int nako=Integer.parseInt(kosu); nako Integer.parseInt(kosu) Integer.parseInt Integer kosu String strArr[] = br.readLine().split(" "); strArr br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] a=new int[nako]; a new int[nako] nako for(int j=0; j<nako; j++){
        		a[j]=Integer.parseInt(strArr[j]);
        	} int j=0; int j=0; j 0 j<nako j nako j++ j++ j {
        		a[j]=Integer.parseInt(strArr[j]);
        	} {
        		a[j]=Integer.parseInt(strArr[j]);
        	} a[j]=Integer.parseInt(strArr[j]) a[j] a j Integer.parseInt(strArr[j]) Integer.parseInt Integer strArr[j] strArr j for(int i=0;i<nako-1;i++){
        	      for(int j=nako-1;j>i;j--){

        		if(a[j]<a[j-1]){
        		  int t=a[j];
        		  a[j]=a[j-1];
        		  a[j-1]=t;
        		}
        	  }
        	} int i=0; int i=0; i 0 i<nako-1 i nako-1 nako 1 i++ i++ i {
        	      for(int j=nako-1;j>i;j--){

        		if(a[j]<a[j-1]){
        		  int t=a[j];
        		  a[j]=a[j-1];
        		  a[j-1]=t;
        		}
        	  }
        	} {
        	      for(int j=nako-1;j>i;j--){

        		if(a[j]<a[j-1]){
        		  int t=a[j];
        		  a[j]=a[j-1];
        		  a[j-1]=t;
        		}
        	  }
        	} for(int j=nako-1;j>i;j--){

        		if(a[j]<a[j-1]){
        		  int t=a[j];
        		  a[j]=a[j-1];
        		  a[j-1]=t;
        		}
        	  } int j=nako-1; int j=nako-1; j nako-1 nako 1 j>i j i j-- j-- j {

        		if(a[j]<a[j-1]){
        		  int t=a[j];
        		  a[j]=a[j-1];
        		  a[j-1]=t;
        		}
        	  } {

        		if(a[j]<a[j-1]){
        		  int t=a[j];
        		  a[j]=a[j-1];
        		  a[j-1]=t;
        		}
        	  } if(a[j]<a[j-1]){
        		  int t=a[j];
        		  a[j]=a[j-1];
        		  a[j-1]=t;
        		} a[j]<a[j-1] a[j] a j a[j-1] a j-1 j 1 {
        		  int t=a[j];
        		  a[j]=a[j-1];
        		  a[j-1]=t;
        		} int t=a[j]; t a[j] a j a[j]=a[j-1] a[j] a j a[j-1] a j-1 j 1 a[j-1]=t a[j-1] a j-1 j 1 t long sum=0; sum 0 for(int i=0; i<nako; i++){
        		sum+=a[i];
        	} int i=0; int i=0; i 0 i<nako i nako i++ i++ i {
        		sum+=a[i];
        	} {
        		sum+=a[i];
        	} sum+=a[i] sum a[i] a i System.out.println(a[0]+" "+a[nako-1]+" "+sum) System.out.println System.out System System.out a[0]+" "+a[nako-1]+" "+sum " " a[nako-1] a[0]+" "+a[nako-1]+" "+sum a[0] a 0 " " a[nako-1] a nako-1 nako 1 " " sum String[] args args
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    		String kosu=br.readLine();
    		int nako=Integer.parseInt(kosu);
        	String strArr[] = br.readLine().split(" ");
        	int[] a=new int[nako];

        	for(int j=0; j<nako; j++){
        		a[j]=Integer.parseInt(strArr[j]);
        	}

        	for(int i=0;i<nako-1;i++){
        	      for(int j=nako-1;j>i;j--){

        		if(a[j]<a[j-1]){
        		  int t=a[j];
        		  a[j]=a[j-1];
        		  a[j-1]=t;
        		}
        	  }
        	}

        	long sum=0;
        	for(int i=0; i<nako; i++){
        		sum+=a[i];
        	}

        	System.out.println(a[0]+" "+a[nako-1]+" "+sum);

    }
}