human
I found an interesting problem on https://www.codechef.com/SMTC2020/problems/BBALLS:
Motu and Patlu are playing with a Magical Ball. Patlu find some interesting pattern in the motion of the ball that ball always bounce back from the ground after travelling a linear distance whose value is some power of $2$. Patlu gave Motu total distance $D$ travelled by the ball and ask him to calculate the minimum number of bounces that the ball makes before coming to rest.

-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- Each testcase contains of a single line of input, single integers $D$.
- Note : Power of $2$ must be a non-negative integer. 

-----Output:-----
For each testcase, output in a single line answer, the minimum number of bounces the ball makes before coming to rest.

-----Constraints-----
- $1 \leq T \leq 10^5$
- $1$ $\leq$ $M$< $10$^18

-----Sample Input:-----
1
13 

-----Sample Output:-----
2

-----EXPLANATION:-----

I tried it in Python, but could not do it. Can you solve it?
assistant
#Here is Python program to find some interesting pattern in the motion of the ball that ball always bounce back from the ground after travelling a linear distance whose value is some power of $2$.

# def b(n):
#     str=""
#     if n>1:
#         b(n//2)
#     print(n%2,end="")
t=int(input())
for i in range(t):
    n=int(input())
    # b(n)
    binary=bin(n)
    setBits=[ones for ones in binary[2:] if ones=='1']
    print(len(setBits)-1)