import sys N = int(input()) A = list(map(int, input().split())) if len(A) > 1: print('assert') sys.exit() A += [int(input()) for i in range(N-1)] ans = set() for i in range(3): for j in range(i+1, 3): ans.add(A[i]+A[j]) ans = list(ans) ans.sort(reverse=True) print(ans[1])