Abhishek and Ms. Jasmine

0

0 votes
Problem

Abhishek Azad is quite skilled at fighting. People of IT-4,5,6 had a great time with Abhishek and Ms. Jasmine Bedi fighting over everything in nearly each PDFS lecture during their third semester. One such fight turned geeky and Ms. Jasmine Bedi gave Abhishek a task to prove his intelligence. She asked Abhishek to bring a code to solve the following problem , you have a large number of marbles and there is a number written on each marble .

P1.She said to Abhishek that at any time you are allowed to choose one marble from the sack.

P2.After selecting a marble he read the number written on that marble and perform the XOR of the number on that marble with every other marble in the sack and finally discard the marble selected in P1.

P3.He OR the result of each XOR in P2 and store the final result in the result array (task is challenging :P:P).

He repeat this untill there is no marble in the sack after P1 .

Now .the results obtained in the result array are ORed together. He decides to impress Ms. Jasmine Bedi with his programming skills . As he is busy with someone these days ;) (quite busy indeed)so he request you to write a code for him . Remember he is a great miser. Warning : Large input output data. Be careful with certain languages.

Input first line of input contains, n, the number of marbles in the sack . Then n line follows containing the number written on each marble.

Output Output in each case the value k, the number on his mind after performing the operations on every possible tuple.

Constraints

2<=Number of Marbles<=10^6

1<=Number written on each marble <=10^18

Problem Setter : Faraz Ghazi Problem Tester : Abhishek Azad

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?