题目描述
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well.
In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is reachable from all other cities.
For each pair of distinct cities $i$ and $j$, the cost of building a road between these cities is equal to ($i \wedge j$), where $\wedge$ denotes the bitwise AND operation. However, leaders of the cities have a weird condition ― they only allow roads with positive costs to be built from their cities.
Help the Mayor find the minimum cost of building roads in the required way or determine that it is impossible.
------ Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first and only line of each test case contains a single integer $N$.
------ Output ------
For each test case, print a single line containing one integer ― the minimum cost of building the roads or $-1$ if it is impossible.
------ Constraints ------
$1 ≤ T ≤ 2 \cdot 10^{5}$
$2 ≤ N ≤ 10^{9}$
----- Sample Input 1 ------
2
3
5
----- Sample Output 1 ------
3
8
----- explanation 1 ------
Example case 1: We can connect city $1$ with city $3$ by a road with cost $1$ and city $3$ with city $2$ by a road with cost $2$.
输入格式
见题面
输出格式
见题面