#K80187. Maximum XOR of a Subsequence
Maximum XOR of a Subsequence
Maximum XOR of a Subsequence
You are given an array of integers. Your task is to find the maximum XOR value obtainable from any non-empty subsequence of the array.
A subsequence is a sequence that can be derived from the array by deleting some or no elements without changing the order. Although the problem asks for the maximum XOR value, it turns out that the answer is simply the bitwise OR of all the array elements. This is because for any subsequence the XOR value is bounded by the combination of bits set in the original numbers, which is exactly what the bitwise OR computes.
In mathematical terms, if the array is (a_1, a_2, \dots, a_n), then the maximum XOR value is given by
[ \text{result} = a_1 ;|; a_2 ;|; \dots ;|; a_n ]
Your solution should read from standard input and write to standard output.
inputFormat
The input consists of two lines. The first line contains a single integer (N) denoting the number of elements in the array. The second line contains (N) space-separated integers representing the elements of the array.
outputFormat
Output a single integer which is the maximum XOR value of any non-empty subsequence of the array.## sample
3
3 10 5
15
</p>