The array of integers is given. Find the sum of the smallest and the largest elements of the array.

Input

The first line contains the number of elements $n(n≤100)$ in the array. The second line contains $n$ elements of the array. Each number in the array does not exceed $100$ in absolute value.

Output

Print the sum of the smallest and the largest elements of the array.