import java.io.*;
import java.util.*;

class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		br.readLine();
		List<String> a=Arrays.asList(br.readLine().split(" "));
		int n1=Integer.parseInt(a.get(0));
        int min=n1,max=n1;
        long sum=n1;
        for(Iterator<String> i=a.iterator();i.hasNext();){
			String s=i.next();
        	int n2=Integer.parseInt(s);
            if(n2<min) min=n2;
            if(n2>max) max=n2;
            sum+=n2;
		}
        System.out.println(min+" "+max+" "+(sum-n1));
	}
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz