P18358 [CodeChef] UNCHANGEDOR
普及-
题目描述

Chef was recently studying the [Bitwise OR] operation, and stumbled upon the following problem:

Let F(i) = 1 \ | \ 2 \ | \ 3 \ | \ $\ldots$ \ | \ i, where | denotes bitwise OR.

You are given an integer N. Find the number of distinct i such that 2 ≤ i ≤ N and F(i) = F(i-1).

------ Input Format ------

  • The first line of input will contain an integer T — the number of test cases. The description of T test cases follows.
  • The first and only line of each test case contains an integer N.

------ Output Format ------

For each test case, output the number of distinct i such that 2 ≤ i ≤ N and F(i) = F(i-1).

------ Constraints ------

$1 ≤ T ≤ 10^{5}$
$2 ≤ N ≤ 10^{9}$

----- Sample Input 1 ------
3
2
3
4
----- Sample Output 1 ------
0
1
1
----- explanation 1 ------
We have:

$F(1) = 1$

$F(2) = 3$

$F(3) = 3$

$F(4) = 7$

Test case $1$: $F(2) \neq F(1)$. Hence the answer is $0$.

Test case $2$: For $i = 3$, $F(i) = F(i-1)$. Hence the answer is $1$.

Test case $3$: For $i = 3$, $F(i) = F(i-1)$. For $i = 2, 4$, $F(i) \neq F(i-1)$. Hence the answer is $1$.

输入格式

见题面

输出格式

见题面

样例输入
3 2 3 4
样例输出
0 1 1