def A002326VS(n): s, m, N = 0, 1, 2*n + 1 while True: k = N + m v = valuation(k, 2) s += v m = k >> v if m == 1: break return s for _ in range(int(input())): n = int(input()) print(A002326VS(n))