Maximum XOR (Hard)#4508

Maximum XOR (Hard)

1 second
64 megabytes
Hard

Vasylko has non-negative integers: a_1, a_2, \ldots, a_N. He and his friend Vitaliy, tired of the usual bitwise operations and , decided to explore something new. Vasylko asked Vitaliy, the programmer, to compute the sum for every possible non-empty subsequence of these numbers. From the resulting 2^N-1 numbers, they want to find the maximum value.

Given the large number of integers Vasylko is dealing with this time, Vitaliy cannot solve the problem by brute force. Your task is to assist him, ensuring that Vasylko remains confident in the abilities of programmers.

Input

The first line contains the integer , 1 \leq N \leq 100000. The second line contains integers, 0 \leq a_i \leq 2 \cdot 10^9.

Output

Output a single integer, which is the maximum sum obtained from any non-empty subsequence.

Examples

Example 1

Loading
Loading