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
Eddy Cael: 2016-06-08 14:36:50

I fixed the description problem. Thanks.

mkfeuhrer: 2016-05-31 13:34:00

AC in 1 go :-)

comp0zr: 2016-05-17 04:29:40

For those of you who got WA despite flawless outputs on example cases, you likely did what I did and overlooked a small detail mentioned in the initial description; even without it, the relatively small values used in the examples will still produce the correct output if your algorithm is otherwise correct. Fun problem!

abc_c: 2016-01-31 12:37:47

AC in 1st go... :)
REVERSED not inverted.

sharath_111: 2016-01-26 20:39:36

good one,ac in one go my 18 th :)

try2catch: 2016-01-24 09:05:21

AC in 1st shot B)
Warning ! its reversed not inverted.

suresh_india7: 2016-01-05 20:13:40

ac in one go ;)

sumit suthar: 2015-11-04 10:56:42

nice one... :)

Dipjal: 2015-08-29 14:46:52

if ( n is odd ) then print -> n else idx = n&(-n) ; n/=idx; print->n reversing bits simply implies to divide 'n' by largest 2^n which is divisible of n right? it is giving wa ... :/

dwij28: 2015-08-25 21:32:17

3 lines in python :D


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