atcoder#ARC135C. [ARC135C] XOR to All
[ARC135C] XOR to All
Score : points
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 $\mathrm{XOR}$?
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.
Constraints
Input
Input is given from Standard Input from the following format:
Output
Print the maximum possible value of after your operations.
5
1 2 3 4 5
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 .
5
10 10 10 10 10
50
Doing zero operations achieves .
5
3 1 4 1 5
18