The popular idol Ninomae Ina'nis is hosting a New Year concert! Many of her fans, known as Takodachis, have come out to watch her perform. At the reception, there are
To do so, Ina can perform the following operation: choose two Takodachis indexed at
What is the minimum possible height such that all Takodachis' height can be equal to it after some, possibly zero, number of operations?
Constraints
Subtask 1 [40%]
Subtask 2 [60%]
No additional constraints.
Input Specification
The first line contains an integer
The next line contains
Output Specification
If it is impossible to make all Takodachis the same height, output
Otherwise, output the minimum possible height such that all Takodachis can be equal to that height after some, possibly zero, number of operations.
Sample Input
4
1 2 3 4
Sample Output
10
Comments