import math x = int(input()) listt = list(map(int, input().split())) z = max(listt) for i in listt: if i < z: z = i print(listt[z])