import java.io.*;

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

        int n = Integer.parseInt(br.readLine());
        String[] str = br.readLine().split(" ");
        long[] num = new long[n];
        for(int i=0; i<n; i++){
            num[i] = Long.parseLong(str[i]);
        }
        int min = 0, max = 0;
        long sum = num[0];
        for(int i=1; i<n; i++){
            sum += num[i];
            if(num[i] < num[min]){
                min = i;
            }else if(num[i] > num[max]){
                max = i;
            }
        }
        sb.append(num[min]).append(" ").append(num[max]).append(" ").append(sum).append("\n");

        System.out.print(sb);



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

        int n = Integer.parseInt(br.readLine());
        String[] str = br.readLine().split(" ");
        long[] num = new long[n];
        for(int i=0; i<n; i++){
            num[i] = Long.parseLong(str[i]);
        }
        int min = 0, max = 0;
        long sum = num[0];
        for(int i=1; i<n; i++){
            sum += num[i];
            if(num[i] < num[min]){
                min = i;
            }else if(num[i] > num[max]){
                max = i;
            }
        }
        sb.append(num[min]).append(" ").append(num[max]).append(" ").append(sum).append("\n");

        System.out.print(sb);



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

        int n = Integer.parseInt(br.readLine());
        String[] str = br.readLine().split(" ");
        long[] num = new long[n];
        for(int i=0; i<n; i++){
            num[i] = Long.parseLong(str[i]);
        }
        int min = 0, max = 0;
        long sum = num[0];
        for(int i=1; i<n; i++){
            sum += num[i];
            if(num[i] < num[min]){
                min = i;
            }else if(num[i] > num[max]){
                max = i;
            }
        }
        sb.append(num[min]).append(" ").append(num[max]).append(" ").append(sum).append("\n");

        System.out.print(sb);



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

        int n = Integer.parseInt(br.readLine());
        String[] str = br.readLine().split(" ");
        long[] num = new long[n];
        for(int i=0; i<n; i++){
            num[i] = Long.parseLong(str[i]);
        }
        int min = 0, max = 0;
        long sum = num[0];
        for(int i=1; i<n; i++){
            sum += num[i];
            if(num[i] < num[min]){
                min = i;
            }else if(num[i] > num[max]){
                max = i;
            }
        }
        sb.append(num[min]).append(" ").append(num[max]).append(" ").append(sum).append("\n");

        System.out.print(sb);



    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringBuilder sb = new StringBuilder(); sb new StringBuilder() int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] str = br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " long[] num = new long[n]; num new long[n] n for(int i=0; i<n; i++){
            num[i] = Long.parseLong(str[i]);
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            num[i] = Long.parseLong(str[i]);
        } {
            num[i] = Long.parseLong(str[i]);
        } num[i] = Long.parseLong(str[i]) num[i] num i Long.parseLong(str[i]) Long.parseLong Long str[i] str i int min = 0 min 0 max = 0; max 0 long sum = num[0]; sum num[0] num 0 for(int i=1; i<n; i++){
            sum += num[i];
            if(num[i] < num[min]){
                min = i;
            }else if(num[i] > num[max]){
                max = i;
            }
        } int i=1; int i=1; i 1 i<n i n i++ i++ i {
            sum += num[i];
            if(num[i] < num[min]){
                min = i;
            }else if(num[i] > num[max]){
                max = i;
            }
        } {
            sum += num[i];
            if(num[i] < num[min]){
                min = i;
            }else if(num[i] > num[max]){
                max = i;
            }
        } sum += num[i] sum num[i] num i if(num[i] < num[min]){
                min = i;
            }else if(num[i] > num[max]){
                max = i;
            } num[i] < num[min] num[i] num i num[min] num min {
                min = i;
            } min = i min i if(num[i] > num[max]){
                max = i;
            } num[i] > num[max] num[i] num i num[max] num max {
                max = i;
            } max = i max i sb.append(num[min]).append(" ").append(num[max]).append(" ").append(sum).append("\n") sb.append(num[min]).append(" ").append(num[max]).append(" ").append(sum).append sb.append(num[min]).append(" ").append(num[max]).append(" ").append(sum) sb.append(num[min]).append(" ").append(num[max]).append(" ").append sb.append(num[min]).append(" ").append(num[max]).append(" ") sb.append(num[min]).append(" ").append(num[max]).append sb.append(num[min]).append(" ").append(num[max]) sb.append(num[min]).append(" ").append sb.append(num[min]).append(" ") sb.append(num[min]).append sb.append(num[min]) sb.append sb num[min] num min " " num[max] num max " " sum "\n" System.out.print(sb) System.out.print System.out System System.out sb String[]args args public class Main{
    public static void main(String[]args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();

        int n = Integer.parseInt(br.readLine());
        String[] str = br.readLine().split(" ");
        long[] num = new long[n];
        for(int i=0; i<n; i++){
            num[i] = Long.parseLong(str[i]);
        }
        int min = 0, max = 0;
        long sum = num[0];
        for(int i=1; i<n; i++){
            sum += num[i];
            if(num[i] < num[min]){
                min = i;
            }else if(num[i] > num[max]){
                max = i;
            }
        }
        sb.append(num[min]).append(" ").append(num[max]).append(" ").append(sum).append("\n");

        System.out.print(sb);



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

        int n = Integer.parseInt(br.readLine());
        String[] str = br.readLine().split(" ");
        long[] num = new long[n];
        for(int i=0; i<n; i++){
            num[i] = Long.parseLong(str[i]);
        }
        int min = 0, max = 0;
        long sum = num[0];
        for(int i=1; i<n; i++){
            sum += num[i];
            if(num[i] < num[min]){
                min = i;
            }else if(num[i] > num[max]){
                max = i;
            }
        }
        sb.append(num[min]).append(" ").append(num[max]).append(" ").append(sum).append("\n");

        System.out.print(sb);



    }
} Main
import java.io.*;

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

        int n = Integer.parseInt(br.readLine());
        String[] str = br.readLine().split(" ");
        long[] num = new long[n];
        for(int i=0; i<n; i++){
            num[i] = Long.parseLong(str[i]);
        }
        int min = 0, max = 0;
        long sum = num[0];
        for(int i=1; i<n; i++){
            sum += num[i];
            if(num[i] < num[min]){
                min = i;
            }else if(num[i] > num[max]){
                max = i;
            }
        }
        sb.append(num[min]).append(" ").append(num[max]).append(" ").append(sum).append("\n");

        System.out.print(sb);



    }
}