Chika has recently decided to learn more about binary. She decides that numbers are nice when they, when written in binary, have a count of ones that is divisible by 3. Consequently, 7 is the smallest positive integer that Chika considers nice.
She wants to know, for several , how many positive integers less than or equal are nice. Help her!
Constraints
Input Specification
The first line contains a single positive integer, .
Each of the next lines contains a single positive integer, .
Output Specification
Output lines. On the th line, output the answer for the given value of .
Sample Input
1
7
Sample Output
1
Comments