AND Maximum Spanning Tree

Limits 1s, 256 MB

You have a weighted undirected complete graph of $N$ nodes numbered from $0$ to $N-1$.
The weight of the edge between node $A$ and $B$ is defined as $A$&$B$ (where & denotes bitwise AND operation).
Can you find the cost of the maximum spanning tree of this graph ?

Input

First line of input consists of a single integer $T$, the number of test cases.
Each test case consists of one line. First and only line of each test case contains $N$, the number of nodes.

$1 ≤ T ≤ 10$
$1 ≤ N ≤ 2*10^5$

Output

For each test case, print one integer — cost of the maximum spanning tree of the graph.

Sample

InputOutput
4
3
6
11
8

0
8
39
21

A complete graph is a simple undirected graph in which every pair of distinct vertices is connected by a unique edge.