import sys
import math
input = sys.stdin.readline

i = int(input())
arr = list(map(int, input().split()))

maxNum = sum(arr)
#maxNum = maxNum << 1
bits = []
a = 1
flag = False
carry = 0
res = 0

while a <= maxNum:
    carry = 0
    #for q in arr:
    s = sum([1 for x in arr if x & a != 0]) + carry
    #print("For a=", a, "we have sum as ", s)
    if s > 0: res += a

    if s > 1:
        carry = 1#1

    a = a << 1
print(res)