i=input t=int n=t(i()) for r in range(n): c=0 x=t(i()) while x>0: c+=x%2 x>>=1 print(c)