n=int(input()) ls=[input() for i in range(n)] if len(ls)!=n: print("assert") else: l=list(map(int,ls)) l.sort() print(ls[n-1]+ls[n-2])