import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.util.Arrays;

/**
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_4_D
 * 
 * @author eitatsuro
 * 
 */
public class Main {
    private final static String SPACE = " ";
    public static void main(String[] args) {
        try {
            LineNumberReader stdReader = new LineNumberReader(
                    new InputStreamReader(System.in));
            
            String sStr;
            int n = 0;
            int[] an = null;
            while ((sStr = stdReader.readLine()) != null) {
                if (stdReader.getLineNumber() == 1) {
                    String[] inputs = sStr.split(" ");
                    n = Integer.valueOf(inputs[0]);
                }
                
                if (stdReader.getLineNumber() == 2) {
                    String[] inputs = sStr.split(" ");
                    int i = 0;
                    an = new int[n];
                    for (String input : inputs) {
                        an[i] = Integer.parseInt(input);
                        i++;
                    }
                }
            }
            // sort by ascending order.
            Arrays.sort(an);
            System.out.print(an[0]);
            System.out.print(SPACE);
            System.out.print(an[n - 1]);
            System.out.print(SPACE);
            long sum = 0;
            for (int a : an) {
                sum += a;
            }
            System.out.println(sum);
            
            stdReader.close();
        } catch (Exception e) {
            System.exit(-1);
        }
    }
} import java.io.InputStreamReader; InputStreamReader java.io import java.io.LineNumberReader; LineNumberReader java.io import java.util.Arrays; Arrays java.util public class Main {
    private final static String SPACE = " ";
    public static void main(String[] args) {
        try {
            LineNumberReader stdReader = new LineNumberReader(
                    new InputStreamReader(System.in));
            
            String sStr;
            int n = 0;
            int[] an = null;
            while ((sStr = stdReader.readLine()) != null) {
                if (stdReader.getLineNumber() == 1) {
                    String[] inputs = sStr.split(" ");
                    n = Integer.valueOf(inputs[0]);
                }
                
                if (stdReader.getLineNumber() == 2) {
                    String[] inputs = sStr.split(" ");
                    int i = 0;
                    an = new int[n];
                    for (String input : inputs) {
                        an[i] = Integer.parseInt(input);
                        i++;
                    }
                }
            }
            // sort by ascending order.
            Arrays.sort(an);
            System.out.print(an[0]);
            System.out.print(SPACE);
            System.out.print(an[n - 1]);
            System.out.print(SPACE);
            long sum = 0;
            for (int a : an) {
                sum += a;
            }
            System.out.println(sum);
            
            stdReader.close();
        } catch (Exception e) {
            System.exit(-1);
        }
    }
} Main private final static String SPACE = " "; SPACE " " public static void main(String[] args) {
        try {
            LineNumberReader stdReader = new LineNumberReader(
                    new InputStreamReader(System.in));
            
            String sStr;
            int n = 0;
            int[] an = null;
            while ((sStr = stdReader.readLine()) != null) {
                if (stdReader.getLineNumber() == 1) {
                    String[] inputs = sStr.split(" ");
                    n = Integer.valueOf(inputs[0]);
                }
                
                if (stdReader.getLineNumber() == 2) {
                    String[] inputs = sStr.split(" ");
                    int i = 0;
                    an = new int[n];
                    for (String input : inputs) {
                        an[i] = Integer.parseInt(input);
                        i++;
                    }
                }
            }
            // sort by ascending order.
            Arrays.sort(an);
            System.out.print(an[0]);
            System.out.print(SPACE);
            System.out.print(an[n - 1]);
            System.out.print(SPACE);
            long sum = 0;
            for (int a : an) {
                sum += a;
            }
            System.out.println(sum);
            
            stdReader.close();
        } catch (Exception e) {
            System.exit(-1);
        }
    } main {
        try {
            LineNumberReader stdReader = new LineNumberReader(
                    new InputStreamReader(System.in));
            
            String sStr;
            int n = 0;
            int[] an = null;
            while ((sStr = stdReader.readLine()) != null) {
                if (stdReader.getLineNumber() == 1) {
                    String[] inputs = sStr.split(" ");
                    n = Integer.valueOf(inputs[0]);
                }
                
                if (stdReader.getLineNumber() == 2) {
                    String[] inputs = sStr.split(" ");
                    int i = 0;
                    an = new int[n];
                    for (String input : inputs) {
                        an[i] = Integer.parseInt(input);
                        i++;
                    }
                }
            }
            // sort by ascending order.
            Arrays.sort(an);
            System.out.print(an[0]);
            System.out.print(SPACE);
            System.out.print(an[n - 1]);
            System.out.print(SPACE);
            long sum = 0;
            for (int a : an) {
                sum += a;
            }
            System.out.println(sum);
            
            stdReader.close();
        } catch (Exception e) {
            System.exit(-1);
        }
    } try {
            LineNumberReader stdReader = new LineNumberReader(
                    new InputStreamReader(System.in));
            
            String sStr;
            int n = 0;
            int[] an = null;
            while ((sStr = stdReader.readLine()) != null) {
                if (stdReader.getLineNumber() == 1) {
                    String[] inputs = sStr.split(" ");
                    n = Integer.valueOf(inputs[0]);
                }
                
                if (stdReader.getLineNumber() == 2) {
                    String[] inputs = sStr.split(" ");
                    int i = 0;
                    an = new int[n];
                    for (String input : inputs) {
                        an[i] = Integer.parseInt(input);
                        i++;
                    }
                }
            }
            // sort by ascending order.
            Arrays.sort(an);
            System.out.print(an[0]);
            System.out.print(SPACE);
            System.out.print(an[n - 1]);
            System.out.print(SPACE);
            long sum = 0;
            for (int a : an) {
                sum += a;
            }
            System.out.println(sum);
            
            stdReader.close();
        } catch (Exception e) {
            System.exit(-1);
        } catch (Exception e) {
            System.exit(-1);
        } Exception e {
            System.exit(-1);
        } System.exit(-1) System.exit System -1 1 {
            LineNumberReader stdReader = new LineNumberReader(
                    new InputStreamReader(System.in));
            
            String sStr;
            int n = 0;
            int[] an = null;
            while ((sStr = stdReader.readLine()) != null) {
                if (stdReader.getLineNumber() == 1) {
                    String[] inputs = sStr.split(" ");
                    n = Integer.valueOf(inputs[0]);
                }
                
                if (stdReader.getLineNumber() == 2) {
                    String[] inputs = sStr.split(" ");
                    int i = 0;
                    an = new int[n];
                    for (String input : inputs) {
                        an[i] = Integer.parseInt(input);
                        i++;
                    }
                }
            }
            // sort by ascending order.
            Arrays.sort(an);
            System.out.print(an[0]);
            System.out.print(SPACE);
            System.out.print(an[n - 1]);
            System.out.print(SPACE);
            long sum = 0;
            for (int a : an) {
                sum += a;
            }
            System.out.println(sum);
            
            stdReader.close();
        } LineNumberReader stdReader = new LineNumberReader(
                    new InputStreamReader(System.in)); stdReader new LineNumberReader(
                    new InputStreamReader(System.in)) String sStr; sStr int n = 0; n 0 int[] an = null; an null while ((sStr = stdReader.readLine()) != null) {
                if (stdReader.getLineNumber() == 1) {
                    String[] inputs = sStr.split(" ");
                    n = Integer.valueOf(inputs[0]);
                }
                
                if (stdReader.getLineNumber() == 2) {
                    String[] inputs = sStr.split(" ");
                    int i = 0;
                    an = new int[n];
                    for (String input : inputs) {
                        an[i] = Integer.parseInt(input);
                        i++;
                    }
                }
            } (sStr = stdReader.readLine()) != null (sStr = stdReader.readLine()) sStr stdReader.readLine() stdReader.readLine stdReader null {
                if (stdReader.getLineNumber() == 1) {
                    String[] inputs = sStr.split(" ");
                    n = Integer.valueOf(inputs[0]);
                }
                
                if (stdReader.getLineNumber() == 2) {
                    String[] inputs = sStr.split(" ");
                    int i = 0;
                    an = new int[n];
                    for (String input : inputs) {
                        an[i] = Integer.parseInt(input);
                        i++;
                    }
                }
            } if (stdReader.getLineNumber() == 1) {
                    String[] inputs = sStr.split(" ");
                    n = Integer.valueOf(inputs[0]);
                } stdReader.getLineNumber() == 1 stdReader.getLineNumber() stdReader.getLineNumber stdReader 1 {
                    String[] inputs = sStr.split(" ");
                    n = Integer.valueOf(inputs[0]);
                } String[] inputs = sStr.split(" "); inputs sStr.split(" ") sStr.split sStr " " n = Integer.valueOf(inputs[0]) n Integer.valueOf(inputs[0]) Integer.valueOf Integer inputs[0] inputs 0 if (stdReader.getLineNumber() == 2) {
                    String[] inputs = sStr.split(" ");
                    int i = 0;
                    an = new int[n];
                    for (String input : inputs) {
                        an[i] = Integer.parseInt(input);
                        i++;
                    }
                } stdReader.getLineNumber() == 2 stdReader.getLineNumber() stdReader.getLineNumber stdReader 2 {
                    String[] inputs = sStr.split(" ");
                    int i = 0;
                    an = new int[n];
                    for (String input : inputs) {
                        an[i] = Integer.parseInt(input);
                        i++;
                    }
                } String[] inputs = sStr.split(" "); inputs sStr.split(" ") sStr.split sStr " " int i = 0; i 0 an = new int[n] an new int[n] n for (String input : inputs) {
                        an[i] = Integer.parseInt(input);
                        i++;
                    } String input inputs {
                        an[i] = Integer.parseInt(input);
                        i++;
                    } {
                        an[i] = Integer.parseInt(input);
                        i++;
                    } an[i] = Integer.parseInt(input) an[i] an i Integer.parseInt(input) Integer.parseInt Integer input i++ i Arrays.sort(an) Arrays.sort Arrays an System.out.print(an[0]) System.out.print System.out System System.out an[0] an 0 System.out.print(SPACE) System.out.print System.out System System.out SPACE System.out.print(an[n - 1]) System.out.print System.out System System.out an[n - 1] an n - 1 n 1 System.out.print(SPACE) System.out.print System.out System System.out SPACE long sum = 0; sum 0 for (int a : an) {
                sum += a;
            } int a an {
                sum += a;
            } {
                sum += a;
            } sum += a sum a System.out.println(sum) System.out.println System.out System System.out sum stdReader.close() stdReader.close stdReader String[] args args public class Main {
    private final static String SPACE = " ";
    public static void main(String[] args) {
        try {
            LineNumberReader stdReader = new LineNumberReader(
                    new InputStreamReader(System.in));
            
            String sStr;
            int n = 0;
            int[] an = null;
            while ((sStr = stdReader.readLine()) != null) {
                if (stdReader.getLineNumber() == 1) {
                    String[] inputs = sStr.split(" ");
                    n = Integer.valueOf(inputs[0]);
                }
                
                if (stdReader.getLineNumber() == 2) {
                    String[] inputs = sStr.split(" ");
                    int i = 0;
                    an = new int[n];
                    for (String input : inputs) {
                        an[i] = Integer.parseInt(input);
                        i++;
                    }
                }
            }
            // sort by ascending order.
            Arrays.sort(an);
            System.out.print(an[0]);
            System.out.print(SPACE);
            System.out.print(an[n - 1]);
            System.out.print(SPACE);
            long sum = 0;
            for (int a : an) {
                sum += a;
            }
            System.out.println(sum);
            
            stdReader.close();
        } catch (Exception e) {
            System.exit(-1);
        }
    }
} public class Main {
    private final static String SPACE = " ";
    public static void main(String[] args) {
        try {
            LineNumberReader stdReader = new LineNumberReader(
                    new InputStreamReader(System.in));
            
            String sStr;
            int n = 0;
            int[] an = null;
            while ((sStr = stdReader.readLine()) != null) {
                if (stdReader.getLineNumber() == 1) {
                    String[] inputs = sStr.split(" ");
                    n = Integer.valueOf(inputs[0]);
                }
                
                if (stdReader.getLineNumber() == 2) {
                    String[] inputs = sStr.split(" ");
                    int i = 0;
                    an = new int[n];
                    for (String input : inputs) {
                        an[i] = Integer.parseInt(input);
                        i++;
                    }
                }
            }
            // sort by ascending order.
            Arrays.sort(an);
            System.out.print(an[0]);
            System.out.print(SPACE);
            System.out.print(an[n - 1]);
            System.out.print(SPACE);
            long sum = 0;
            for (int a : an) {
                sum += a;
            }
            System.out.println(sum);
            
            stdReader.close();
        } catch (Exception e) {
            System.exit(-1);
        }
    }
} Main
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.util.Arrays;

/**
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_4_D
 * 
 * @author eitatsuro
 * 
 */
public class Main {
    private final static String SPACE = " ";
    public static void main(String[] args) {
        try {
            LineNumberReader stdReader = new LineNumberReader(
                    new InputStreamReader(System.in));
            
            String sStr;
            int n = 0;
            int[] an = null;
            while ((sStr = stdReader.readLine()) != null) {
                if (stdReader.getLineNumber() == 1) {
                    String[] inputs = sStr.split(" ");
                    n = Integer.valueOf(inputs[0]);
                }
                
                if (stdReader.getLineNumber() == 2) {
                    String[] inputs = sStr.split(" ");
                    int i = 0;
                    an = new int[n];
                    for (String input : inputs) {
                        an[i] = Integer.parseInt(input);
                        i++;
                    }
                }
            }
            // sort by ascending order.
            Arrays.sort(an);
            System.out.print(an[0]);
            System.out.print(SPACE);
            System.out.print(an[n - 1]);
            System.out.print(SPACE);
            long sum = 0;
            for (int a : an) {
                sum += a;
            }
            System.out.println(sum);
            
            stdReader.close();
        } catch (Exception e) {
            System.exit(-1);
        }
    }
}