Time

11:30:50
11 Feb 2012
ACM-ICPC Thailand Southern Region Programming Contest 2011
Left: 3 hours 30 minutes
End: 11.02.2012 15:00
Leader: Informatimukas
Five for week 22
Left: 10 hours 30 minutes
End: 11.02.2012 22:00
Leader: NuM
Version for print

The sum of the largest and smallest

   One-dimensional array A of integers is given. Find the sum of the least and the biggest element in array.


Specifications

   Input

   In the first line the number of elements h in array is given (h ≤ 100). In the second line the elements of array are given. Each number in array by absolute value does not exceed 100.

   Output

   In one line print one number - the answer to the problem.


Problem information

Time Limit: 0.5 seconds
Memory Limit: 64 MB
Balls for the passed test: 1.66667
Complexity: 8% 835/906
Source: SFE-2010 Variant 28
Classes: Beginners

Example

Example input

4
1 2 3 4

Example output

5


← Number of toys Problems Parallelogram →