Bits

You are given N positive integers.
For every integer, you can choose to either swap two bits in its binary representation, or do nothing.
Your task is to compute the maximum integer that can be obtained from every given value.

Input

The first line of input contains N.
The second line of input contains N space-separated integers.

Output

The only line of output should contain all N maximum values that can be obtained, separated by spaces.

Restrictions

  • 1 ≤ N ≤ 1000
  • 0 ≤ any number < 231

Sample

InputOutput
4
1 5 6 9
1 6 6 12
Questions?

Sponsors Gold