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: EASY
Tags: Implementation

Complete search
Skill types: Complete search

Starter code:

Solutions:
n = int(input())
l = [int(i) for i in input().split()]
y = 0
for i in range(n):
	t = 0
	for j in range(i, n):
		t ^= l[j]
		y = max(y, t)
print(y)


n = int(input())
lista = list(map(int, input().split()))
maximo = 0
for i in range(len(lista)):
	current = 0
	for j in range(i, len(lista)):
		current ^= lista[j]
		maximo = max(maximo, current)
print(maximo)


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))))


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())
ans = 0
l = list(map(int, input().split()))
for i in range(n):
	x = 0
	for j in range(i, n):
		x = x ^ l[j]
		ans = max(ans, x)
print(ans)


n = int(input())
arr = list(map(int, input().split()))
max_xor = -19999
for i in range(1, n + 1):
	for j in range(n - i + 1):
		cur_xor = arr[j]
		for h in range(j, j + i - 1):
			cur_xor = cur_xor ^ arr[h + 1]
		max_xor = max(cur_xor, max_xor)
print(max_xor)


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


from functools import reduce
n = int(input())
sequencia = list(map(int, input().split(' ')))
maximo = 0
for i in range(len(sequencia)):
	for j in range(i, len(sequencia)):
		valor = reduce(lambda x, y: x ^ y, sequencia[i:j + 1])
		if valor > maximo:
			maximo = valor
print(maximo)


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()


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)


def main():
	n = int(input())
	a = list(map(int, input().split(' ')))
	res = -1
	for i in range(0, n):
		for j in range(i, n):
			xor = 0
			for k in range(i, j + 1):
				xor = xor ^ a[k]
			res = max(xor, res)
	print(res)
main()


from functools import reduce

def xor2(x, y):
	return x ^ y
n = int(input())
a = input().split(' ')
a = map(int, a)
a = list(a)
maximo = 0
for sz in range(1, len(a) + 1):
	for i in range(n - sz + 1):
		maximo = max(maximo, reduce(xor2, a[i:sz + i]))
print(maximo)


n = int(input())
entrada = input().split()
arr_a = [int(a) for a in entrada]
result = 0
temp = 0
for i in range(0, n):
	temp = 0
	for j in range(i, n):
		temp = temp ^ arr_a[j]
		result = max(result, temp)
print(result)


n = int(input())
a = list(map(int, input().split()))
out = 0
for i in range(n):
	k = 0
	for j in range(i, -1, -1):
		k = k ^ a[j]
		if k > out:
			out = k
print(out)


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

def xor(s):
	x = 0
	for i in s:
		x ^= i
	return x
mx = -1
for i in range(n):
	for j in range(n):
		if i == j:
			if a[i] > mx:
				mx = a[i]
		else:
			x = xor(a[i:j + 1])
			if x > mx:
				mx = x
print(mx)


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


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)


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)


n = int(input())
s = input().split()
s = [int(x) for x in s]
m = 0
for i in range(n):
	xor = s[i]
	if xor > m:
		m = xor
	for j in range(i + 1, n):
		xor = xor ^ s[j]
		if xor > m:
			m = xor
print(m)


def firstElem(elem):
	return int(elem)
n = int(input())
string = input()
string = string.split()
max_xor = int(max(string, key=firstElem))
for i in range(n):
	a = int(string[i])
	for j in range(i + 1, n):
		b = int(string[j])
		temp_xor = a ^ b
		a = temp_xor
		if temp_xor > max_xor:
			max_xor = temp_xor
print(max_xor)


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))


import sys
import math
import itertools
import functools
import collections
import operator

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return ' '.join(map(str, arr))

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
n = ii()
a = li()
ans = max(a)
for i in range(n):
	tl = tr = a[i]
	for j in range(i):
		tl = max(tl, functools.reduce(operator.xor, a[j:i + 1]))
	for j in range(i, n):
		tr = max(tr, functools.reduce(operator.xor, a[i:j + 1]))
	ans = max(ans, tr, tl)
print(ans)


import math, sys
from collections import defaultdict, deque
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')

def I():
	return int(sys.stdin.readline())

def In():
	return map(int, sys.stdin.readline().split())

def Sn():
	return sys.stdin.readline().strip()

def Pr(x):
	sys.stdout.write(str(x) + '\n')

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gte(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		ans = 0
		n = I()
		l = list(In())
		for i in range(n):
			cnt = l[i]
			ans = max(cnt, ans)
			for j in range(i + 1, n):
				cnt ^= l[j]
				ans = max(cnt, ans)
		print(ans)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(1):
	main()


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)


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)


n = int(input())
l = list(map(int, input().split()))
an = 0
for i in range(len(l)):
	for j in range(i, len(l)):
		x = 0
		for k in range(i, j + 1):
			x = x ^ l[k]
		an = max(x, an)
print(an)


def xor_f(arr):
	result = 0
	for i in arr:
		result = result ^ i
	return result
n = int(input())
arr = [int(i) for i in input().split()]
result = float('-inf')
for i in range(n):
	for j in range(i, min(i + n, n)):
		result = max(result, xor_f(arr[i:j + 1]))
print(result)


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())
a = list(map(int, input().split()))
maxxor = 0
for i in range(n):
	xor = 0
	for j in range(i, n):
		xor = xor ^ a[j]
		maxxor = max(xor, maxxor)
print(maxxor)


import sys
import string
from collections import Counter, defaultdict
from math import fsum, sqrt, gcd, ceil, factorial
from itertools import combinations, permutations
flush = lambda : sys.stdout.flush
comb = lambda x, y: factorial(x) // factorial(y) // factorial(x - y)
ip = lambda : input()
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())
n = ii()
arr = rr()
ans = xor = 0
for i in range(n):
	xor = 0
	for j in range(i, n):
		xor ^= arr[j]
		ans = max(ans, xor)
print(ans)


from functools import reduce
from operator import xor
n = int(input())
xs = [int(s) for s in input().split()]
ans = 0
for i in range(n):
	for j in range(i + 1, n + 1):
		ans = max(ans, reduce(xor, xs[i:j]))
print(ans)


import math
n = int(input())
ans = 0
a = list(map(int, input().split()))
for i in range(n):
	x = 0
	for j in range(i, n):
		x = x ^ a[j]
		ans = max(ans, x)
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)


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)


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


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))


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


def fxor(a):
	xor = 0
	for i in a:
		xor ^= i
	return xor
n = int(input())
a = [int(i) for i in input().split()]
max_xor = 0
for i in range(n):
	for j in range(i, n):
		if fxor(a[i:j + 1]) > max_xor:
			max_xor = fxor(a[i:j + 1])
print(max_xor)


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


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())
a = input().split()
a = [int(i) for i in a]
mx = 0
for i in range(n):
	for j in range(i, n):
		ans = 0
		for k in range(i, j + 1):
			ans ^= a[k]
		mx = max(mx, ans)
print(mx)


import sys
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
n = ii()
d = li()
pre = [0]
for i in d:
	pre.append(pre[-1] ^ i)
res = 0
for i in range(n + 1):
	for j in range(i + 1, n + 1):
		res = max(res, pre[j] ^ pre[i])
print(res)


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


d = [[0 for x in range(120)] for y in range(120)]
n = int(input())
a = list(map(int, input().split()))
rs = max(a)
for i in range(len(a)):
	d[i][0] = a[i]
for i in range(len(a)):
	for j in range(1, len(a) - i):
		d[i][j] = d[i][j - 1] ^ a[i + j]
		rs = max(rs, d[i][j])
print(rs)


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)


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)


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())
arr = list(map(int, input().split()))
ans = 0
for i in range(n):
	k = 0
	for j in range(i, n):
		k ^= arr[j]
		ans = max(ans, k)
print(ans)


n = int(input())
a = list(map(int, input().split()))
i = 0
b = []
if n == 1:
	print(a[0])
else:
	while i < n - 1:
		xor = a[i]
		b.append(a[i])
		for j in range(i + 1, n):
			xor = xor ^ a[j]
			b.append(a[j])
			b.append(xor)
		i = i + 1
	b = list(set(b))
	print(max(b))


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


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


answer = 0
now = 0
num = int(input())
arr = list()
nums = input().split(' ')
for i in range(num):
	arr.append(int(nums[i]))
for i in range(num):
	now = 0
	for j in range(i, num):
		now = now ^ arr[j]
		answer = max(now, answer)
print(answer)


from itertools import accumulate
from operator import xor
n = int(input())
A = [0] + list(accumulate(map(int, input().split()), xor))
print(max((A[i] ^ A[j] for i in range(n + 1) for j in range(i + 1, n + 1))))


from math import ceil, sqrt, gcd, log, floor
from collections import deque

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())

def msi():
	return map(str, input().strip().split(' '))

def lsi():
	return list(msi())
n = ii()
a = li()
s = 0
for i in range(n):
	s1 = a[i]
	s2 = a[i]
	for j in range(i + 1, n):
		s1 ^= a[j]
		s2 = max(s2, s1)
	s = max(s, s2)
print(s)


n = input()
array = input().split()
maximum = 0
limit = len(array)
i = 0
while i < limit:
	j = i
	counting = 0
	while j < limit:
		counting ^= int(array[j])
		if maximum < counting:
			maximum = counting
		j += 1
	i += 1
print(maximum)


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))))


import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
arr = list(map(int, input().split()))
max_val = max(arr)
for i in range(0, n):
	temp = arr[i]
	for j in range(i + 1, n):
		temp = temp ^ arr[j]
		max_val = max(max_val, temp)
	max_val = max(max_val, temp)
print(max_val)


def main():
	n = int(input())
	a = input().split()
	a = [int(x) for x in a]
	maxi = 0
	for i in range(n):
		num = a[i]
		if num > maxi:
			maxi = num
		for j in range(i + 1, n):
			num = num ^ a[j]
			if num > maxi:
				maxi = num
	print(maxi)
	return
main()


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


inputs = int(input())
numList = [int(x) for x in input().split()]
maxValue = 0
for i in range(inputs):
	xor = 0
	for j in range(i, -1, -1):
		xor ^= numList[j]
		maxValue = max(xor, maxValue)
print(maxValue)


def solve(arr):
	max_val = 0
	for i in range(len(arr)):
		cur_total = 0
		for j in range(i, len(arr)):
			cur_total ^= arr[j]
			max_val = max(max_val, cur_total)
	return max_val
n = int(input())
arr = list(map(int, input().split(' ')))
print(solve(arr))


import collections as cc
import sys
I = lambda : list(map(int, input().split()))
(n,) = I()
l = I()
temp = 0
ans = max(l)
for i in range(n):
	c = l[i]
	for j in range(i + 1, n):
		ans = max(ans, c)
		c ^= l[j]
	ans = max(ans, c)
print(ans)


(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)


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def debug(*var, sep=' ', end='\n'):
	print(*var, file=sys.stderr, end=end, sep=sep)
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
(n,) = I()
a = I()
ans = 0
for i in range(n):
	cur = 0
	for j in range(i, n):
		cur ^= a[j]
		ans = max(ans, cur)
print(ans)


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)
main()


n = int(input())
l = list(map(int, input().split()))
pre = [0] * (n + 1)
for i in range(1, n + 1):
	pre[i] = pre[i - 1] ^ l[i - 1]
ans = []
for i in range(n + 1):
	for j in range(n + 1):
		ans.append(pre[j] ^ pre[i])
print(max(ans))


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


tamanho = int(input())
entrada = input()
entrada_str = list(entrada.split(' '))
entrada_int = list(map(int, entrada_str))
vetor = entrada_int
atual = 0
retorno = 0
for i in range(tamanho):
	atual = 0
	for j in range(i, tamanho):
		atual = atual ^ vetor[j]
		retorno = max(retorno, atual)
print(retorno)


n = input()
lst = [int(x) for x in input().split(' ')]
res = []
for (i, l) in enumerate(lst):
	res.append(l)
	for j in range(i + 1, len(lst)):
		l ^= lst[j]
		res.append(l)
print(max(res))


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


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


n = int(input())
a = input().split()
xor = 0
ans = int(a[0])
for i in range(n):
	for j in range(i, n):
		ans = int(a[i])
		for k in range(i + 1, j + 1):
			ans = ans ^ int(a[k])
		if ans >= xor:
			xor = ans
print(xor)


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


import math
for i in range(1):
	n = int(input())
	l = list(map(int, input().split()))
	ans = 0
	for i in range(n):
		c = 0
		for j in range(i, n):
			c = c ^ l[j]
			ans = max(ans, c)
	print(ans)


l1 = int(input())
l2 = input().split()
l2 = [int(i) for i in l2]
x = 0
y = 0
for i in range(l1):
	y = 0
	for j in range(i, l1):
		y = y ^ l2[j]
		x = max(x, y)
print(x)


a = int(input())
b = input().split()
for x in b:
	b[b.index(x)] = int(x)
d = 0
for x in range(a):
	for y in range(a - x):
		c = b[x]
		for z in b[x + 1:y + x + 1]:
			c = c ^ z
		if c > d:
			d = c
print(d)


maxi = 0
n = int(input())
l = [int(i) for i in input().split()]

def xorseq(l):
	x = 0
	for i in l:
		x ^= i
	return x
for i in range(n):
	for j in range(i, n):
		if xorseq(l[i:j + 1]) > maxi:
			maxi = xorseq(l[i:j + 1])
print(maxi)