Input Format
The first line contains . The second line contains an array   of  integers each separated by a space.
Constraints
Output Format
Print the runner-up score.

### Problem solution in python 2 programming language.

if __name__ == '__main__':
n = int(raw_input())
arr = map(int, raw_input().split())
m1 = max(arr)
m2 = -9999999999
for i in range(n):
if arr[i] != m1 and arr[i] > m2:
m2 = arr[i]
print m2

#### second solution

from collections import Counter
if __name__ == '__main__':
n = int(raw_input())
arr = Counter(map(int, raw_input().split())).keys()
arr.sort()
print arr[-2]

#### Third solution

from collections import Counter
if __name__ == '__main__':
n = int(raw_input())
arr = list(set(map(int, raw_input().split())))
arr.sort()
print arr[-2]

### Problem solution in python 3 programming language.

if __name__ == '__main__':
n = int(input())
arr = map(intinput().split())
arr = list(arr)
x = max(arr)
y = -9999999
for i in range(0,n):
if arr[i]<x and arr[i] > y:
y = arr[i]
print(y)