Extra Perfect Numbers
##### Submissions: 772   Accuracy: 48.73%   Difficulty: Easy   Marks: 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

#### ** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Harshit Sidhwa
Author: harshitsidhwa

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.