for _ in range(int(input())): N=int(input()) X=0 Y=0 if bin(N).count('1')==0: N-=1 for i in reversed(range(64)): if (N>>i)&1>0: if X<=Y: X+=1<