#arc135c. [arc135_c]XOR to All
[arc135_c]XOR to All
Problem Statement
You are given a sequence of non-negative integers . You can do the operation below any number of times (possibly zero).
- Choose an integer .
- Replace with for every ( denotes the bitwise operation).
Find the maximum possible value of after your operations.
What is bitwise ?
The bitwise of non-negative integers and , , is defined as follows:
- When is written in base two, the digit in the 's place () is if exactly one of and is , and otherwise.
For example, we have (in base two: ).
Constraints
Input
Input is given from Standard Input from the following format:
Output
Print the maximum possible value of after your operations.
Sample Input 1
5
1 2 3 4 5
Sample Output 1
19
Here is a sequence of operations that achieves .
- Initially, the sequence is .
- An operation with changes it to .
- An operation with changes it to , where .
Sample Input 2
5
10 10 10 10 10
Sample Output 2
50
Doing zero operations achieves .
Sample Input 3
5
3 1 4 1 5
Sample Output 3
18