You are given N non-negative integers: A_1, A_2, ..., A_N. You need to paint at least one and at most N-1 integers in red and the rest in blue. The beauty of the painting is the XOR of the integers painted in red, plus the XOR of the integers painted in blue. Find the maximum possible beauty of the painting. The bitwise XOR of n non-negative integers x_1, x_2, ..., x_n is defined such that when x_1 XOR x_2 XOR ... XOR x_n is written in base two, the digit in the 2^k's place (k ≥ 0) is 1 if the number of integers among x_1, x_2, ..., x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even. For example, 3 XOR 5 = 6. All input values are integers, 2 ≤ N ≤ 10^5, and 0 ≤ A_i < 2^60 (1 ≤ i ≤ N). The input is given in the format: N A_1 A_2 ... A_N. Print the maximum possible beauty of the painting.

# Buggy version:
from numpy import *
N=int(input())
A=array(input().split(),int64)
f=bitwise_xor.reduce
X=f(A)
A=hstack(([1<<i for i in range(60)if X>>i],A))
for k in range(60)[::-1]:
  b=1<<k
  j=A&b!=0
  i=where(j&(A<2*b))[0]
  if len(i):i=i[0];x=A[i];A[j]^=x;A[i]=x
r=f(A)
print(r+(r^X))

# Fixed version:
from numpy import *
f=bitwise_xor.reduce
N=int(input())
A=array(input().split(),int64)
X=f(A)
A=hstack((A,array([1<<i for i in range(60)if X&(1<<i)],int64)))
for k in range(60)[::-1]:
  b=1<<k
  j=A&b!=0
  i=where(j&(A<2*b))[0]
  if len(i):i=i[0];x=A[i];A[j]^=x;A[i]=x
r=f(A)
print(r+(r^X))

# Buggy version:
n = int(input())
a = list(map(int, input().split()))

p = [0] * 62

def insert(x):
    for i in range(60, -1, -1):
        if x >> i & 1:
            if not p[i]:
                p[i] = x
                break
            x ^= p[i]

all = 0 
for x in a:
    all ^= x

for i in range(61):
    if all >> i & 1:
        for j in range(n):
            if a[j] >> i & 1:
                a[j] -= (1<<i)

for x in a:
    insert(x)
ans = 0
for i in range(60, -1, -1):
    if p[i]:
      ans |= 1 << i
print(ans + (ans ^ all))


# Fixed version:
n = int(input())
a = list(map(int, input().split()))

p = [0] * 62

def insert(x):
    for i in range(60, -1, -1):
        if x >> i & 1:
            if not p[i]:
                p[i] = x
                break
            x ^= p[i]

all = 0 
for x in a:
    all ^= x

for i in range(61):
    if all >> i & 1:
        for j in range(n):
            if a[j] >> i & 1:
                a[j] -= (1<<i)

for x in a:
    insert(x)
ans = 0
for i in range(60, -1, -1):
    if (p[i] ^ ans) > ans:
        ans = p[i] ^ ans
print(ans + (ans ^ all))

# Buggy version:
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
a = np.bitwise_xor.reduce(A)
A^=a
for k in range(60, -1, -1):
    bit = 1<<k
    one = (A&bit != 0)
    i = np.where(one & (A < (1<<(k+1))))[0]
    if len(i) == 0:
        continue
    i = i[0]
    x = A[i]
    A[one]^=x
    A[i] = x
b = np.bitwise_xor.reduce(A)
a^=b
print(a+b)

# Fixed version:
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())), dtype = np.int64)
a = np.bitwise_xor.reduce(A)
for i in range(60):
    bit = 1<<i
    if bit & a:
        A^=(A&bit)
for k in range(60, -1, -1):
    bit = 1<<k
    one = (A&bit != 0)
    i = np.where(one & (A < (1<<(k+1))))[0]
    if len(i) == 0:
        continue
    i = i[0]
    x = A[i]
    A[one]^=x
    A[i] = x
b = np.bitwise_xor.reduce(A)
a^=b
print(a+b)

# Buggy version:
'''
Created on 2019/09/23

@author: oiwaiman
'''


import numpy as np

n = int(input())
aaa = np.fromiter(list(map(int, input().split())), np.int64)

all_x = np.bitwise_xor.reduce(aaa)

mask = ~all_x
bbb = aaa & mask

ans = 0
while True:
    a = bbb.max()
    if a == 0:
        break
    b = 1<<(int(a).bit_length() -1)
    bbb[bbb & b > 0] ^= a
    if ans & b == 0:
        ans ^= b

print (ans*2 + all_x)

# Fixed version:
'''
Created on 2019/09/23

@author: oiwaiman
'''


import numpy as np

n = int(input())
aaa = np.fromiter(list(map(int, input().split())), np.int64)

all_x = np.bitwise_xor.reduce(aaa)

mask = ~all_x
bbb = aaa & mask

ans = 0
while True:
    a = bbb.max()
    if a == 0:
        break
    b = 1<<(int(a).bit_length() -1)
    bbb[bbb & b > 0] ^= a
    if ans & b == 0:
        ans ^= a


print (ans*2 + all_x)

# Buggy version:
import sys
input = sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))

XOR=0
for a in A:
    XOR^=a

for i in range(N):
    A[i] &=~XOR
    
USED=[0]*60

for bi in range(60,-1,-1):
    for i in range(N):
        if USED[i]==0 and A[i] & (1<<bi)!=0:
            USED[i]=1
            useind=i
            break
    else:
        continue

    for i in range(N):
        if i==useind:
            continue
        if A[i] & (1<<bi)!=0:
            A[i]^=A[useind]
            print(A[i],A[useind])
            
ANS=0
for a in A:
    ANS^=a

print(2*ANS+XOR)


# Fixed version:
import sys
input = sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))

XOR=0
for a in A:
    XOR^=a

for i in range(N):
    A[i] &=~XOR
    
USED=[0]*N

for bi in range(60,-1,-1):
    for i in range(N):
        if USED[i]==0 and A[i] & (1<<bi)!=0:
            USED[i]=1
            useind=i
            break
    else:
        continue

    for i in range(N):
        if i==useind:
            continue
        if A[i] & (1<<bi)!=0:
            A[i]^=A[useind]
            
ANS=0
for a in A:
    ANS^=a

print(2*ANS+XOR)

# Buggy version:
from heapq import *
N = int(input())
A = [int(a) for a in input().split()]
x, t, s, i, h = 0, 0, 0, 59, []
for a in A:
    t ^= a
for a in A:
    heappush(h, -(a&~t))
while h:
    a = -heappop(h)
    while (a >> i) & 1 == 0 and i >= 0:
        i -= 1
        x = 0
    if i < 0: break
    if x:
        heappush(h, -(a^x))
    else:
        x = a
        s = max(s, s^x)
print(s+(t^s))

# Fixed version:
from heapq import *
N = int(input())
A = [int(a) for a in input().split()]
x, t, s, i, h = 0, 0, 0, 59, []
for a in A:
    t ^= a
for a in A:
    heappush(h, -(a&~t))
while h:
    a = -heappop(h)
    while i >= 0 and (a >> i) & 1 == 0:
        i -= 1
        x = 0
    if i < 0: break
    if x:
        heappush(h, -(a^x))
    else:
        x = a
        s = max(s, s^x)
print(s+(t^s))