eolymp
Problems

The sum of the largest and the smallest

The sum of the largest and the smallest

Time limit 1 second
Memory limit 128 MiB

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

Input data

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 data

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

Examples

Input example #1
4
1 2 3 4
Output example #1
5
Source SFE-2010 Variant 28