N = int(input()) test = input() if len(test) == 1: A = [int(test)] for _ in range(N-1): A += [int(input())] L = [A[0]+A[1], A[0]+A[2], A[1]+A[2]] L.sort(reverse=True) if L[0] > L[1]: print(L[1]) else: print(L[2]) else: print("assert")