Maximum XOR of two numbers

Given N non-negative integers, find the maximum XOR over all pairs of distinct elements.

Medium6Bit manipulationTrieInterviewNo attempts yetTime limit2sMemory limit512 MB

Problem

You are given NN numbers. Write a program that finds the two numbers whose XOR is the largest.

That is, among A1,A2,,ANA_1, A_2, \dots, A_N, find the largest value of AiAjA_i \oplus A_j over all index pairs with iji \neq j.

Input

The first line contains NN (2N100,0002 \le N \le 100{,}000).

The second line contains NN numbers. Every number given in the input is a non-negative integer no greater than 1,000,000,0001{,}000{,}000{,}000.

Output

Print the XOR of the two numbers whose XOR is the largest on the first line.