100 atcoder#ABC197C. [ABC197C] ORXOR
[ABC197C] ORXOR
Score : points
Problem Statement
Given is a number sequence of length . Let us divide this sequence into one or more non-empty contiguous intervals. Then, for each of these intervals, let us compute the bitwise of the numbers in it. Find the minimum possible value of the bitwise of the values obtained in this way.
What is bitwise $\mathrm{OR}$?
The bitwise of integers and , , is defined as follows:
- When is written in base two, the digit in the 's place () is if at least one of and is , and otherwise.
For example, we have (in base two: ).
Generally, the bitwise of integers is defined as $(\dots ((p_1\ \mathrm{OR}\ p_2)\ \mathrm{OR}\ p_3)\ \mathrm{OR}\ \dots\ \mathrm{OR}\ p_k)$. We can prove that this value does not depend on the order of .
What is bitwise $\mathrm{XOR}$?
The bitwise of 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: ).
Generally, the bitwise of integers is defined as $(\dots ((p_1\ \mathrm{XOR}\ p_2)\ \mathrm{XOR}\ p_3)\ \mathrm{XOR}\ \dots\ \mathrm{XOR}\ p_k)$. We can prove that this value does not depend on the order of .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
3
1 5 7
2
If we divide into and , their bitwise s are and , whose is . It is impossible to get a smaller result, so we print .
3
10 10 10
0
We should divide this sequence into and .
4
1 3 3 1
0
We should divide this sequence into and .