The last contest held on Johnny's favorite competitive programming platform has been received rather positively. However, Johnny's rating has dropped again! He thinks that the presented tasks are lovely, but don't show the truth about competitors' skills.

The boy is now looking at the ratings of consecutive participants written in a binary system. He thinks that the more such ratings differ, the more unfair is that such people are next to each other. He defines the difference between two numbers as the number of bit positions, where one number has zero, and another has one (we suppose that numbers are padded with leading zeros to the same length). For example, the difference of $5 = 101_2$ and $14 = 1110_2$ equals to $3$, since $0101$ and $1110$ differ in $3$ positions. Johnny defines the unfairness of the contest as the sum of such differences counted for neighboring participants.

Johnny has just sent you the rating sequence and wants you to find the unfairness of the competition. You have noticed that you've got a sequence of consecutive integers from $0$ to $n$. That's strange, but the boy stubbornly says that everything is right. So help him and find the desired unfairness for received numbers.


-----Input-----

The input consists of multiple test cases. The first line contains one integer $t$ ($1 \leq t \leq 10\,000$) — the number of test cases. The following $t$ lines contain a description of test cases.

The first and only line in each test case contains a single integer $n$ ($1 \leq n \leq 10^{18})$.


-----Output-----

Output $t$ lines. For each test case, you should output a single line with one integer — the unfairness of the contest if the rating sequence equals to $0$, $1$, ..., $n - 1$, $n$.


-----Example-----
Input
5
5
7
11
1
2000000000000

Output
8
11
19
1
3999999999987



-----Note-----

For $n = 5$ we calculate unfairness of the following sequence (numbers from $0$ to $5$ written in binary with extra leading zeroes, so they all have the same length):   $000$  $001$  $010$  $011$  $100$  $101$ 

The differences are equal to $1$, $2$, $1$, $3$, $1$ respectively, so unfairness is equal to $1 + 2 + 1 + 3 + 1 = 8$.

Difficulty: interview

Starter code:

Solutions:
import sys

input = sys.stdin.readline


for _ in range(int(input())):
    n = int(input())
    ans = 0
    f = 0
    i = n
    while n:
        ans += i // 2**f
        n //= 2
        f += 1
    print(ans)

t = int(input())
for _ in range(t):
	n = int(input())
	n += 1
	res = 0
	for i in range(60,-1,-1):
		temp = 1<<i 
		if temp <= n:
			temp1 = n//temp 
			if n%temp != 0:
				temp1 += 1 
			res += temp1 - 1 
	print(res)

t = int(input())

for _ in range(t):
    n = int(input())

    cnt = 0
    while n >= 1:
        cnt += n
        n = n // 2
    print(cnt)







t = int(input())
for i in range(t):
    n, k, s = int(input()), 1, 0
    while n > 0:
        n, k, s = n // 2, k + 1, s + ((n+1) // 2) * k
    print(s)


# from decorators import *
from sys import stdin, stdout
from math import ceil

# @debug
def solve(n):
    c = 0
    while n>0:
        c += n
        n //= 2
    
    print(c)

for _ in range(int(input())):
    n = int(stdin.readline())
    # s = list(map(int,stdin.readline().split()))
    solve(n)

import sys
from collections import Counter
T = int(input().strip())
for t in range(T):
    n= int(input().strip())
    # a,b = list(map(int, input().strip().split()))
    res = 0
    d=  1
    while n+1 > d:
        res += ( (n+1)//d + (1 if (n+1)%d else 0) ) - 1
        d *= 2
    print(res)


for _ in range(int(input())):
    ans = 0
    n = int(input())
    x = 1
    while n:
        ans += ((n + 1) // 2) * x
        x += 1
        n -= ((n + 1) // 2)
    print(ans)


t = int(input())
for _ in range(t):
	x = int(input())
	p2 = 1
	ans = 0
	while p2 <= x:
		ans += x // p2
		p2 *= 2
	print(ans)


t = int(input())

for k in range(t):
    n = int(input())
    ans = 0
    while n > 0:
        ans += n
        n >>= 1
    print(ans)

'''
5
5
7
11
1
2000000000000
'''

for _ in range(int(input())):
    n = int(input())
    ind = 0
    ans=0
    while n//(2**ind):
        ans+= n//(2**ind)
        ind+=1
    print(ans)



import sys
def I():
    return sys.stdin.readline().rstrip()

for tc in range(1, 1 + int(I())):
    n = int(I())
    ans = 0
    while n:
        ans += n
        n //= 2
    print(ans)



t=int(input())
def fun(n):

    a=bin(2*n)[2:]
    ans=0
    for i in a:
        if i=="1":
            ans+=1
    print(2*n-ans)
while t:
    t-=1
    n=int(input())
    fun(n)


for testcase in range(int(input())):
    n = int(input())
    logs = []
    i = 1
    while i <= n:
        logs.append(i)
        i *= 2
    unfair = 0
    for log in logs:
        unfair += n  // log
    print(unfair)


t = int(input())
for q in range(t):
	n = int(input())
	ans = 0
	k = 1
	while k <= (n + 1):
		ans += n // k
		k *= 2
	print(ans)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
  N = int(input())
  bn = list(bin(N))[2: ]
  bn.reverse()
  res = 0
  for i in range(len(bn)):
    res += (bn[i] == "1") * (pow(2, i + 1) - 1)
  print(res)

import math

t = int(input())


for qq in range(t):
    n = int(input())
    step = 2
    s = 0
    val = 1
    while n >= step // 2:
        k = n - (step // 2)
        s += val
        s += val * (k // step)
        step *= 2
        val += 1
        #print(s, end = ' ')
    print(s)


import sys
ints = (int(x) for x in sys.stdin.read().split())
sys.setrecursionlimit(3000)

def main():
    ntc = next(ints)
    for tc in range(1,ntc+1):
        n = next(ints)
        b = [int(x) for x in bin(n)[2:]]
        k = len(b)
        ans = 0
        for i in range(k):
            if b[i]:
                ans += 2**(k-i)-1
        print(ans)
    return

main()


import math
def check(a):
	count=0
	i=1
	while(i<=a):
		count=count+a//i
		i*=2
	return count
for _ in range(int(input())):
	a=int(input())
	print(check(a))

from math import log2
t = int(input())
for _ in range(t):
    n = int(input())
    ct = 0
    for i in range(int(log2(n)) + 1):
        ct += n // (2 ** i)
    print(ct)