Problem S
Xor Maximization

As you might have heard, Gunnar is an old and forgetful researcher. Most of his research is in security and he cares a bit too much about his own security, so for each website he has a different password. It would be very hard for him to remember all passwords, so for every website he only remembers the method he used to create the password.
For one of the very important websites he started with a
file containing a long list of non-negative integers. Since he
very much likes the operation
Task
Gunnar’s file contains a list of numbers and he selected a subset of the numbers such that its xor-sum is as large as possible. The resulting number was his password. Unfortunately, he forgot the algorithm to find the subset with the largest xor-sum, so he is asking you for help with restoring his password. Of course, he will not tell you for which website this password is.
Input
The first line of input contains an integer
Output
Output one line with the answer – the maximal number Gunnar can get by selecting a subset of the list of numbers and calculating the xor-sum of the subset.
Sample Input 1 | Sample Output 1 |
---|---|
3 1 3 5 |
7 |
Sample Input 2 | Sample Output 2 |
---|---|
4 2 6 4 8 |
14 |