There are N different streets near the 221B Baker Street. All streets are numbered from 1 to N. Detective Lestrade consults Sherlock Homes to count the no. of gangsters living in the area, with the help of Sherlock’s underground network. Sherlock finds out that the number of gangster living in a particular street is equal to the number of 1’s in the binary representation of the street number. As Mr. Lestrade is weak in arithmetic, help him to find out the number of gangsters living in the area.
The first line of input contains a integer T, denoting the number of test cases. The only line of each test case contains the integer N, described above.
For each test case output a single integer corresponding to the number of gangsters living in the area, in new line.
1<= T <=1000
1<= N <= 106
In test case 1
Total number of streets is 3, so Binary representation of 1,2,3 is
1-> 001, no of 1’s is 1
2-> 010, no of 1’s is 1
3-> 011, no of 1’s is 2
So the Total number of gangsters around 221B Baker Street is 4.