Aaryan, Subsequences And Great XOR
Practice
4.2 (42 votes)
Algorithms
Approved
Bit manipulation
Easy
Open
Problem
62% Success 8072 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
12 votes
Tags:
Bit ManipulationBasic ProgrammingBasics of Bit Manipulation
Points:20
29 votes
Tags:
BitmaskBasic ProgrammingBit ManipulationBasics of Bit ManipulationGreedy AlgorithmsBit manipulation
Points:20
46 votes
Tags:
Ad-HocApprovedBasic ProgrammingEasyOpen