# Aaryan, Subsequences And Great XOR

QUESTION

Aaryan went to school like any usual day, The teacher asked his crush the following question. \n\nGiven an array of numbers, First she had to compute the XOR of all the subsequences that can be formed. \n\nSuppose 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}\n\nNow, the resultant answer is computed by taking bitwise inclusive OR of all P[i]’s\n\nSince, 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.\n\nInput:\n\nFirst line will consist of number N.\nThen in the next line, there will be N numbers, ith number in the line is denoted by A[i]\n\nOutput:\nOutput the required value as answer.\n\nConstraints:\n1 <= N <= 10^6\n0 <= A[i] <= 10^9.

``````#include <stdio.h>
#define getcx getchar_unlocked
#define putcx putchar_unlocked
inline long long int input()
{
long long int n=0;
char ch=getcx();
while( ch < '0' || ch > '9' )
{
ch=getcx();
}
while(  ch >= '0' && ch <= '9' )
{
n = (n<<3)+(n<<1) + ch-'0', ch=getcx();
}
return n;
}
inline void output(long long int n)
{
char a[35];
long long int i=0;
do
{
a[i++]=n%10+48;
n=n/10;
}while(n!=0);
--i;
while(i>=0)
putcx(a[i--]);
putcx(' ');
}
int main()
{
long long int n;
int a,ans=0;
n=input();
while(n--)
{
a=input();
ans|=a;
}
output(ans);
return 0;
}``````