SNUMBER - S Number

You are given a set of numbers. The numbers in the set which is only less than the largest number is called an S-Number. For the number set which contains 8 numbers: 3, 6, 0, -5, 7, 7, 6, 2. The largest number is 7. So the S-Number is 6 because it is only less than 7.

Input

The first line of each case contains a positive integer n that indicates the size of the set. Then n numbers followed, denotes the numbers in the set. The input is terminated by a single line n = 0. All the numbers in the input will be less than 100 and greater than -100.

Solution always exist.

Output

One line contains the S-Number for each case.

Example

Input:
8
3 6 0 -5 7 7 6 2
0

Output:
6

Added by:[UNI]Jonathans
Date:2013-03-14
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:TJU Team Selection Contest 2007 (1)

hide comments
2018-05-21 05:10:34
= Find the second largest value in the input set.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.