#K69557. Maximum XOR of Two Numbers

    ID: 33112 Type: Default 1000ms 256MiB

Maximum XOR of Two Numbers

Maximum XOR of Two Numbers

You are given an array of integers. Your task is to find two numbers in the array such that the bitwise XOR of these two numbers is maximized.

The input consists of two lines. The first line contains a single integer N, representing the number of elements in the array. The second line contains N space-separated integers.

Output a single integer, which is the maximum XOR value of any two numbers in the given array.

The following formula illustrates the XOR operation between two numbers a and b:

$$a \oplus b$$

Hint: An efficient solution may involve using bit manipulation and prefix sets.

inputFormat

The input is read from standard input and is structured as follows:

  • The first line contains an integer N (the number of elements in the array).
  • The second line contains N space-separated integers.

outputFormat

Output a single integer to standard output representing the maximum XOR of any two numbers from the input array.

## sample
6
3 10 5 25 2 8
28

</p>