#C9479. Maximum XOR Pair

    ID: 53576 Type: Default 1000ms 256MiB

Maximum XOR Pair

Maximum XOR Pair

You are given a list of n non-negative integers. Your task is to find two distinct numbers in the list such that their bitwise XOR (denoted as \(\oplus\)) is maximized.

The bitwise XOR operation between two numbers \(a\) and \(b\) is defined as:

[ a \oplus b = c ]

where the \(i\)-th bit of \(c\) is \(1\) if and only if the \(i\)-th bits of \(a\) and \(b\) are different.

Example: For the input list [3, 10, 5, 25, 2], the maximum XOR is achieved by 5 and 25, where \(5 \oplus 25 = 28\).

Note: You must read from standard input (stdin) and write your result to standard output (stdout).

inputFormat

The first line contains a single integer \(n\) representing the number of elements.

The second line contains \(n\) space-separated non-negative integers.

outputFormat

Output a single integer which is the maximum XOR obtainable by taking any two numbers from the list.

## sample
5
3 10 5 25 2
28