Problem:
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});

Min, Max and Sum

Write a program which reads a sequence of $n$ integers $a_i (i = 1, 2, ... n)$, and prints the minimum value, maximum value and sum of the sequence.

Input

In the first line, an integer $n$ is given. In the next line, $n$ integers $a_i$ are given in a line.

Output

Print the minimum value, maximum value and sum in a line. Put a single space between the values.

Constraints

$0 < n \leq 10000$

$-1000000 \leq a_i \leq 1000000$

Sample Input

5
10 1 5 4 17

Sample Output

1 17 37

Solution in JAVA (judge verdict: Wrong Answer)

public class Main {
	public static void main(String[] args) {

		int number = 5;
		int[] a1 = new int[number];

		a1[0] = 10;
		a1[1] = 1;
		a1[2] = 5;
		a1[3] = 4;
		a1[4] = 17;

		int max = a1[0];
		int min = a1[1];
		int total = 0;

		System.out.println(number);
		for (int i = 0; i < 5; i++) {
			int q = a1[i];
			System.out.print(q+" ");
			if (q > max) {
				max = q;

			}
			if (q < min) {
				min = q;

			}
			total+=q;
			
		}

		System.out.println();
		System.out.println(min);
		System.out.println(max);
		System.out.println(total);
		
	}
}