N=int(input()) try: A=[int(input()) for _ in range(N)] AA=sorted(A) a=AA[0]+AA[1] b=AA[0]+AA[2] c=AA[1]+AA[2] AAA=sorted([a,b,c]) if b!=c: print(AAA[1]) else: print(AAA[0]) except: print("assert")