LearnPy Hub
← Arena
AdvancedRating 1800

Largest XOR of Two Numbers

Print the largest value of aᵢ XOR aⱼ over all pairs. Build a bitwise trie (or use the prefix trick) so it works for n up to 10⁵.

Input

n (≥ 2), then n non-negative integers below 2³⁰.

Output

One integer.

Sample 1

Input
6
3 10 5 25 2 8
Output
28

Sample 2

Input
2
0 0
Output
0
solution.py
Output appears here
Largest XOR of Two Numbers · Python Arena problem · LearnPy Hub