T = int(input()) for _ in range(T): N = int(input())+1 ans = 0 for i in range(60): p, q = divmod(N, 1<<(i+1)) ans += p*(1<