Extra Perfect Numbers
Easy Accuracy: 49.41% Submissions: 984 Points: 2

Given a positive integer N. Your task is to write a problem that prints the count of the numbers in the range 1 to N having first and last bits as the only set bits.

Examples:

Input : n = 10
Output : 1 3 5 9
(1)10 = (1)2.
(3)10 = (11)2.
(5)10 = (101)2.
(9)10 = (1001)2

Input:
First line of the input contains an integer T, denoting the number of test cases. Then T test case follows. The only line of each test case contains a single positive integer N.
.
Output:
For each test case output the count of the number having first and last as there only set bits.

Constraints:
1<=T<=103
1<=N<=105

Example:
Input:

3
5
10
66
Output:
3
4
7