eolymp
bolt
Try our new interface for solving problems
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 elements of the array. \InputFile The first line contains the number of elements $n~(n \le 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. \OutputFile Print the sum of the smallest and the largest elements of the array.
Time limit 1 second
Memory limit 128 MiB
Input example #1
4
1 2 3 4
Output example #1
5
Source SFE-2010 Variant 28