Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.

The xor operation is the bitwise exclusive "OR", that is denoted as "xor" in Pascal and "^" in C/C++/Java.


-----Input-----

The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 2^30.


-----Output-----

Print a single integer — the required maximal xor of a segment of consecutive elements.


-----Examples-----
Input
5
1 2 1 1 2

Output
3

Input
3
1 2 7

Output
7

Input
4
4 2 4 8

Output
14



-----Note-----

In the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.

The second sample contains only one optimal segment, which contains exactly one array element (element with index three).

Difficulty: interview

Starter code:

Solutions:
n = int(input()) + 1
t = [0] + list(map(int, input().split()))
for i in range(1, n):
    t[i] = t[i] ^ t[i - 1]
print(max(t[j] ^ t[i] for i in range(0, n) for j in range(i + 1, n)))

n = int(input())
a = [int(i) for i in input().split()]
pref = [0] * (n + 1)
for i in range(n):
    pref[i + 1] = pref[i] ^ a[i]
res = a[0]
for i in range(n):
    for j in range(i, n):
        res = max(res, pref[j + 1] ^ pref[i])
print(res)

n = int(input())
arr = list(map(int, input().split()))
best = 0
for i in range(n):
	x = 0
	for j in range(i, n):
		x = (x^arr[j])
		best = max(best, x)
print(best)


m = int(input())
a = list(map(int, input().split()))

nitest = 0

for i in range(m):
	xor = 0
	for j in range(i, m):
		xor = a[j]^xor
		nitest = max(nitest, xor)
print(nitest)

from operator import xor
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
print(max(reduce(xor, a[i:j + 1]) for i in range(n) for j in range(i, n)))

n = int(input())
st = input()
lis = st.split()
for i in range(n):
    lis[i]= int(lis[i])  
lisRes = []
for i in range(n):
    res = lis[i]
    lisRes.append(res)
    for j in range(i+1,n):
        res ^= lis[j]
        lisRes.append(res)

print(max(lisRes))

N = int(input())
A = list(int(i) for i in input().split())

def rsq(i,j):
	nonlocal A
	if(i==0):
		return A[j]
	return A[j] ^ A[i-1]

for i in range(1,N):
	A[i] = A[i] ^ A[i-1]

maxv = 0	
for i in range(N):
	for j in range(i,N):
		maxv = max(maxv, rsq(i,j))
print (maxv)

def main():
    input()
    x, l = 0, [0]
    for a in map(int, input().split()):
        x ^= a
        l.append(x)
    x = 0
    for i, a in enumerate(l):
        for j in range(i):
            y = a ^ l[j]
            if x < y:
                x = y
    print(x)


def __starting_point():
    main()

__starting_point()

def main():
    input()
    x, l = 0, [0]
    for a in map(int, input().split()):
        x ^= a
        l.append(x)
    print(max(a ^ l[j] for i, a in enumerate(l) for j in range(i)))


def __starting_point():
    main()

__starting_point()

from functools import reduce
n=int(input())
a=list(map(int,input().split()))
print(max([reduce(int.__xor__,a[i:j]) for j in range(1,n+1) for i in range(j)]))

n,ans=int(input()),-10000
a=list(map(int,input().split()))
for i in range(n):
  s=0
  for j in range(i,n):
    s^=a[j]
    ans=max(ans,s)
print(ans)

n = int( input() )
ans = -1
tab = list( map( int, input(). split() ) )
for i in range(n):
	foo = 0
	for j in range(i, n):
		foo ^= tab[j]
		ans = max( ans, foo )
print( ans )


#from dust i have come, dust i will be

n=int(input())
a=list(map(int,input().split()))

m=a[0]

for i in range(len(a)-1):
    x=a[i]
    m=max(m,x)
    for j in range(i+1,len(a)):
        x=x^a[j]
        m=max(m,x)


print(max(m,max(a)))

int_size = 32

class TrieNode:
    def __init__(self):
        self.child = [None]*2
        self.value = 0

class Trie:
    def __init__(self):
        self.root = TrieNode()

    def insert(self, key):
        curr = self.root
        
        for i in range(int_size - 1, -1, -1):
            current_bit = 1 if (key & (1 << i)) else 0

            if curr.child[current_bit] == None:
                curr.child[current_bit] = TrieNode()

            curr = curr.child[current_bit]

        curr.value = key

    def max_xor(self, key): 
        curr = self.root
        for i in range(int_size - 1, -1, -1):
            current_bit = 1 if (key & (1 << i)) else 0
            
            if curr.child[1 - current_bit] != None:
                curr = curr.child[1 - current_bit]
            elif curr.child[current_bit] != None:
                curr = curr.child[current_bit]
            else:
                raise Exception("Something is not right!!")

        return key ^ curr.value


n = int(input())
arr = list(map(int, input().split()))
tree = Trie()
tree.insert(0)

ans = 0
now = 0
for i in range(n):
    now = now ^ arr[i]
    tree.insert(now)
    ans = max(ans, tree.max_xor(now))

print(ans)

count = int(input())
number = [int(i) for i in input().split()]
max = -1
for i in range(0, count):
    tmp = number[i]
    if tmp > max:
        max = tmp
    if not i + 1 == count:    
        for j in range(i + 1, count):
            tmp = tmp ^ number[j]
            if tmp > max:
                max = tmp
print("%d" % max)

count = int(input())
number = [int(i) for i in input().split()]
max = -1
for i in range(0, count):
    tmp = number[i]
    if tmp > max:
        max = tmp    
    for j in range(i + 1, count):
        tmp = tmp ^ number[j]
        if tmp > max:
            max = tmp
print("%d" % max)

n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
	for j in range(i,n):
		cur = 0
		for k in range(i,j + 1):
			cur ^= a[k]
		ans = max(ans, cur)
print(ans)

import itertools
import functools
def allSubArrays(xs):
    n = len(xs)
    indices = list(range(n+1))
    for i,j in itertools.combinations(indices,2):
        yield xs[i:j]
n=int(input())
my_list=list(map(int,input().split(" ")))
list_=list(allSubArrays(my_list))
for i in range(len(list_)):
    list_[i]=functools.reduce(lambda x,y:x^y,list_[i])
print(max(list_))


n=int(input())
mx=0;
a=list(map(int,input().split()))
for i in range(n):
    sum=0
    for j in range(i,n) :
        sum^=a[j]
        mx=max(mx,sum)
print(mx)


n=int(input())
mx=0;
a=list(map(int,input().split()))
for i in range(n):
    sum=0
    for j in range(i,n) :
        sum^=a[j]
        mx=max(mx,sum)
print(mx) 


x = int(input())
a = list(map(int, input().split()))
sum = 0
for i in range(x):
    ans = 0
    for j in range(i, x):
        ans ^= a[j]
        sum = max(ans, sum)
print(sum)

n=int(input());arr=list(map(int,input().split()));mx=0
for i in range(len(arr)):
    t=0
    for j in range(i,len(arr)):
        t^=arr[j]
        mx=max(mx,t)
print(mx)

from math import *
n=int(input());L=[int(x) for x in input().split()];Max=0
for i in range(len(L)):
    t = 0
    for j in range(i, len(L)):
        t ^= L[j]
        Max = max(Max, t)
print(Max)

n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
    x = 0
    for j in range(n - i):
        x ^= a[i + j]
        ans = max(ans, x)
print(ans)

n=int(input())
a=list(map(int,input().split()))
c=[]
for j in range(n):
    l=0
    for i in range(j,len(a)):
        l=l^a[i]
        c.append(l)
print(max(c))