XMAX - XOR Maximization

Given a set of integers S = { a1, a2, a3, ... a|S| }, we define a function X on S as follows:
X( S ) = a1 ^ a2 ^ a3 ^ ... ^ a|S|.
(^ stands for bitwise 'XOR' or 'exclusive or')

Given a set of N integers, compute the maximum of the X-function over all the subsets of the given starting set.

Input

The first line of input contains a single integer N, 1 <= N <= 105.
Each of the next N lines contain an integer ai, 1 <= ai <= 1018.

Output

To the first line of output print the solution.

Example

Input:
3
1
2
4

Output:
7

Added by:gustav
Date:2011-01-26
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:classical problem

hide comments
2014-12-06 09:28:25 Mohd Rahul Islam
@cc fro 1,2,3 answer is 3
2014-01-11 23:28:02 Aditya Bahuguna
awesome problem!! ;)
2013-08-05 06:23:08 Mojtaba FayazBakhsh
nice one!
actually same to sgu 275 with a larger n
2013-03-21 20:12:45 Arpit
Please post some more testcases.
2012-10-15 13:04:33 Trimbitas Petru
http://acm.sgu.ru/problem.php?contest=0&problem=275
RE (by Buda IM): This is not same problem, look at constraints here and there

Last edit: 2013-01-03 16:40:11
2011-10-14 15:56:16 cc
is the output for
3
1
2
3

0?
2011-08-22 15:29:48 manish kapoor
sm more test cases pls...
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.