~/algor $ cat problems/bit-eng-katta-xor-toplam
Largest subset XOR
Hard
1000 ms
128 MB
95%
$n$ non-negative integers are given. We choose any subset of them (it may be empty, its XOR is $0$) and compute the XOR of its elements. Find the largest XOR value. For example, for $9, 8, 5$ the largest is $8 \oplus 5 = 13$.
Input
The first line contains a positive integer $n$. The second line contains $n$ integers $a_{i}$.
Output
One integer — the largest XOR.
Note
$1 \le n \le 10^{5}$
$0 \le a_{i} \lt 2^{60}$
Examples
Input #1
3 9 8 5
Output #1
13
Input #2
1 0
Output #2
0