import java.util.Scanner;
class Main{
    int n,i,a;
    int max = -9999999;
    int min = 9999999;
    long sam = 0;
    public void solve(){
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        for(i = 0; i < n; i++){
            a = sc.nextInt();
            sam += a;
            if(n == 0){
                min = 0;
                max = 0;
            }else if(n == 1){
                max = a;
                min = a;
            }else if(a < min){
                min = a;
            }else if(a > max){
                max = a;
            }else if(a == min || a == max){
                continue;
            }
            
        }
    System.out.println(min + " " + max + " " + sam);
    }
    public static void main(String[] args){
        new Main().solve();
    }
} import java.util.Scanner; Scanner java.util class Main{
    int n,i,a;
    int max = -9999999;
    int min = 9999999;
    long sam = 0;
    public void solve(){
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        for(i = 0; i < n; i++){
            a = sc.nextInt();
            sam += a;
            if(n == 0){
                min = 0;
                max = 0;
            }else if(n == 1){
                max = a;
                min = a;
            }else if(a < min){
                min = a;
            }else if(a > max){
                max = a;
            }else if(a == min || a == max){
                continue;
            }
            
        }
    System.out.println(min + " " + max + " " + sam);
    }
    public static void main(String[] args){
        new Main().solve();
    }
} Main int n n i i a; a int max = -9999999; max -9999999 9999999 int min = 9999999; min 9999999 long sam = 0; sam 0 public void solve(){
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        for(i = 0; i < n; i++){
            a = sc.nextInt();
            sam += a;
            if(n == 0){
                min = 0;
                max = 0;
            }else if(n == 1){
                max = a;
                min = a;
            }else if(a < min){
                min = a;
            }else if(a > max){
                max = a;
            }else if(a == min || a == max){
                continue;
            }
            
        }
    System.out.println(min + " " + max + " " + sam);
    } solve {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        for(i = 0; i < n; i++){
            a = sc.nextInt();
            sam += a;
            if(n == 0){
                min = 0;
                max = 0;
            }else if(n == 1){
                max = a;
                min = a;
            }else if(a < min){
                min = a;
            }else if(a > max){
                max = a;
            }else if(a == min || a == max){
                continue;
            }
            
        }
    System.out.println(min + " " + max + " " + sam);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) n = sc.nextInt() n sc.nextInt() sc.nextInt sc for(i = 0; i < n; i++){
            a = sc.nextInt();
            sam += a;
            if(n == 0){
                min = 0;
                max = 0;
            }else if(n == 1){
                max = a;
                min = a;
            }else if(a < min){
                min = a;
            }else if(a > max){
                max = a;
            }else if(a == min || a == max){
                continue;
            }
            
        } i = 0; i = 0 i 0 i < n i n i++ i++ i {
            a = sc.nextInt();
            sam += a;
            if(n == 0){
                min = 0;
                max = 0;
            }else if(n == 1){
                max = a;
                min = a;
            }else if(a < min){
                min = a;
            }else if(a > max){
                max = a;
            }else if(a == min || a == max){
                continue;
            }
            
        } {
            a = sc.nextInt();
            sam += a;
            if(n == 0){
                min = 0;
                max = 0;
            }else if(n == 1){
                max = a;
                min = a;
            }else if(a < min){
                min = a;
            }else if(a > max){
                max = a;
            }else if(a == min || a == max){
                continue;
            }
            
        } a = sc.nextInt() a sc.nextInt() sc.nextInt sc sam += a sam a if(n == 0){
                min = 0;
                max = 0;
            }else if(n == 1){
                max = a;
                min = a;
            }else if(a < min){
                min = a;
            }else if(a > max){
                max = a;
            }else if(a == min || a == max){
                continue;
            } n == 0 n 0 {
                min = 0;
                max = 0;
            } min = 0 min 0 max = 0 max 0 if(n == 1){
                max = a;
                min = a;
            }else if(a < min){
                min = a;
            }else if(a > max){
                max = a;
            }else if(a == min || a == max){
                continue;
            } n == 1 n 1 {
                max = a;
                min = a;
            } max = a max a min = a min a if(a < min){
                min = a;
            }else if(a > max){
                max = a;
            }else if(a == min || a == max){
                continue;
            } a < min a min {
                min = a;
            } min = a min a if(a > max){
                max = a;
            }else if(a == min || a == max){
                continue;
            } a > max a max {
                max = a;
            } max = a max a if(a == min || a == max){
                continue;
            } a == min || a == max a == min a min a == max a max {
                continue;
            } continue; System.out.println(min + " " + max + " " + sam) System.out.println System.out System System.out min + " " + max + " " + sam " " max min + " " + max + " " + sam min " " max " " sam public static void main(String[] args){
        new Main().solve();
    } main {
        new Main().solve();
    } new Main().solve() new Main().solve new Main() String[] args args
import java.util.Scanner;
class Main{
    int n,i,a;
    int max = -9999999;
    int min = 9999999;
    long sam = 0;
    public void solve(){
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        for(i = 0; i < n; i++){
            a = sc.nextInt();
            sam += a;
            if(n == 0){
                min = 0;
                max = 0;
            }else if(n == 1){
                max = a;
                min = a;
            }else if(a < min){
                min = a;
            }else if(a > max){
                max = a;
            }else if(a == min || a == max){
                continue;
            }
            
        }
    System.out.println(min + " " + max + " " + sam);
    }
    public static void main(String[] args){
        new Main().solve();
    }
}