e-olymp
Problems

The sum of the largest and the smallest

The sum of the largest and the smallest

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

Input

The first line contains the number of elements n (n100) in array. n array elements are given in the second line. Each number in array does not exceed 100 by absolute value.

Output

Print the sum of the smallest and the largest element in array.

Time limit 1 seconds
Memory limit 122.17 MiB
Input example #1
4
1 2 3 4
Output example #1
5
Source SFE-2010 Variant 28