n = int(input()) a = list(map(int, input().split())) if len(a) == 3: print("\"assert\"") else: for _ in range(2): a.append(int(input())) nums = set() for i in range(3): for j in range(i + 1, 3): nums.add(a[i] + a[j]) ans = sorted(nums)[-2] print(ans)