409719: GYM103708 A Anya's gifts

Memory Limit:256 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Anya's giftstime limit per test0.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Anya has a big problem. Her father's birthday and National Father's Day happen in the same week. Anya loves her father so she bought a large number of gifts to give him. Anya doesn't want to give him all gifts in one day, that's why she will give some gifts to her father on his birthday and the rest of them on father's day. Of course, all gifts must be given and her father must receive at least one gift on each of the two dates.

Anya's father is a very elegant man with refined tastes, so his gifts should be as elegant as possible. At the time of purchasing the gifts, the store owner gave an elegance score to each of the gifts. Anya wants to distribute the gifts in such a way that the sum of the XOR of the elegance score of the gifts she gives on Father's Day and the XOR of the elegance score of the gifts she gives on his birthday is maximum.

Help Anya accomplish this difficult and elegant task.

Input

The first line contains an integer $$$N$$$ ( $$$2 \leq N \leq10^{5}$$$ )indicating the number of gifts Anya bought.

The next line contains $$$N$$$ integers $$$e_{i}$$$ ($$$0 \leq e_{i} < 2^{50}$$$) for $$$i = 1,2...N$$$, denoting the score of elegance of each present.

Output

Output a single line with an integer representing the result of this task.

ExamplesInput
4
1 2 4 8
Output
15
Input
4
10 8 6 17
Output
41

加入题单

上一题 下一题 算法标签: