Aaryan, Subsequences And Great XOR
Practice
4.2 (42 votes)
Algorithms
Approved
Bit manipulation
Easy
Open
Problem
62% Success 8073 Attempts 20 Points 2s Time Limit 256MB Memory 1024 KB Max Code

Aaryan went to school like any usual day, The teacher asked his crush the following question. Given an array of numbers, First she had to compute the XOR of all the subsequences that can be formed. Suppose each subsequence had their following XOR value that came out after computing -> {P[0], P[1], P[2], and so on upto P[2^n-1] subsequences in an array of n numbers}

Now, the resultant answer is computed by taking bitwise inclusive OR of all P[i]'s

Since, Aaryan wants to impress his crush, He wants to compute the answer for this problem but since he is not so good at it, he turned to you for help.

Input:
First line will consist of number N.
Then in the next line, there will be N numbers, ith number in the line is denoted by A[i]

Output:
Output the required value as answer.

Constraints:
1 <= N <= 10^6
0 <= A[i] <= 10^9

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
2 votes
Tags:
Bit ManipulationBasics of Bit ManipulationBasic Programming
Points:20
11 votes
Tags:
BitmaskBasics of Bit ManipulationBasic ProgrammingBit ManipulationBit manipulationBasics of bit manipulation
Points:20
15 votes
Tags:
SortingBasic ProgrammingBit ManipulationMerge SortBasics of Bit ManipulationAlgorithmsBit manipulationBitmask