import math

name = raw_input()
n = int(name)
num = []
for j in range(0,n):
    x=raw_input()
    y =int(x)
    num.append(y)
for k in range(0,n) :
    a = num[k]
    b=math.frexp(a)
    c=b[1]
    z = 2**(c-1)
    f = a-z
    m = 1 + (f*2)
    print m