EC_CONB - Even Numbers


 

Marina is a college girl who likes to play with all kinds of numbers. One day she was very bored and decided to play around with even numbers.
She notes N numbers on the board(odd and even numbers) and then, she modifies only even numbers (for some reason she likes the odd numbers) and inverts its binary representation and replaces each even number. But soon she gets bored and ask  you help in order to automate the conversion process.

Marina is a college girl who likes to play with all kinds of numbers. One day she was very bored and decided to play around with even numbers.

She writes N numbers on the board (odd and even numbers) and then, she modifies only even numbers (for some reason she likes the odd numbers) and reversed its binary representation (from the left to the right ) and replaces each even number. But soon she gets bored and ask  you help in order to automate the conversion process.

Input

In the first line contains the value of N. This integer is followed by N lines, every one with a positive integer ai (1 <= ai <= 10^7).

Output

The output will contain N lines, the numbers that are on the blackboard after the conversion process.

Example

Input:
5
10
8
3
5
2

Output:
5
1
3
5
1

hide comments
raichu7: 2017-08-19 00:49:44

AC is one go ! :)

rishikeshwar: 2017-07-02 12:26:42

@rish23101998
Binary representation of 10 is 1010 and reversing it becomes 0101 which equals to 5, which is justified in the sample output

rish23101998: 2017-07-02 09:17:12

binary representation of 10 is 1010 but output given here is 1...why??

aditya9125: 2017-06-29 09:03:21

Try bitset class of c++, it would everything for you.

rohit_2407: 2017-05-24 13:40:30

use strtoll for conversion of binary to decimal !'

ankit1cool: 2017-05-17 11:33:23

is there any better logic than o(n*b)
where b=no of bits

ameyanator: 2017-03-18 20:35:32

compiled it in the wrong language and submitted it :/. Stupid me. Easy question btw! :)

nilabja16180: 2017-03-14 15:44:38

AC in ONE GO!
bit manipulation!

up79: 2017-02-22 07:39:42

easy one :)

kass_97: 2017-01-11 19:35:22

Easy peasy, just implement whatever method comes in your mind first


Added by:Eddy Cael
Date:2013-10-12
Time limit:1s
Source limit:2000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C CSHARP CPP C++ 4.3.2 C99 HASK JAVA PYTHON RUBY