import java.util.Scanner;
class Main{
    int n,i;
    int max = -9999999;
    int min = 9999999;
    long sam = 0;

    public void solve(){
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        int a[] = new int[n];
        for(i = 0; i < n; i++){
            a[i] = sc.nextInt();
            sam = sam + a[i];
            if(n == 0){
                min = 0;
                max = 0;
            }else if(n == 1){
                max = a[i];
                min = a[i];
            }else if(a[i] < min){
                min = a[i];
            }else if(a[i] > max){
                max = a[i];
            }else if(a[i] == min || a[i] == 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;
    int max = -9999999;
    int min = 9999999;
    long sam = 0;

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

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