Colossal! — exclaimed Hawk-nose. — A programmer! That's exactly what we are looking for.Arkadi and Boris Strugatsky. Monday starts on Saturday

Reading the book "Equations of Mathematical Magic" Roman Oira-Oira and Cristobal Junta found an interesting equation: $a - (a \oplus x) - x = 0$ for some given $a$, where $\oplus$ stands for a bitwise exclusive or (XOR) of two integers (this operation is denoted as ^ or xor in many modern programming languages). Oira-Oira quickly found some $x$, which is the solution of the equation, but Cristobal Junta decided that Oira-Oira's result is not interesting enough, so he asked his colleague how many non-negative solutions of this equation exist. This task turned out to be too difficult for Oira-Oira, so he asks you to help.


-----Input-----

Each test contains several possible values of $a$ and your task is to find the number of equation's solution for each of them. The first line contains an integer $t$ ($1 \le t \le 1000$) — the number of these values.

The following $t$ lines contain the values of parameter $a$, each value is an integer from $0$ to $2^{30} - 1$ inclusive.


-----Output-----

For each value of $a$ print exactly one integer — the number of non-negative solutions of the equation for the given value of the parameter. Print answers in the same order as values of $a$ appear in the input.

One can show that the number of solutions is always finite.


-----Example-----
Input
3
0
2
1073741823

Output
1
2
1073741824



-----Note-----

Let's define the bitwise exclusive OR (XOR) operation. Given two integers $x$ and $y$, consider their binary representations (possibly with leading zeroes): $x_k \dots x_2 x_1 x_0$ and $y_k \dots y_2 y_1 y_0$. Here, $x_i$ is the $i$-th bit of the number $x$ and $y_i$ is the $i$-th bit of the number $y$. Let $r = x \oplus y$ be the result of the XOR operation of $x$ and $y$. Then $r$ is defined as $r_k \dots r_2 r_1 r_0$ where:

$$ r_i = \left\{ \begin{aligned} 1, ~ \text{if} ~ x_i \ne y_i \\ 0, ~ \text{if} ~ x_i = y_i \end{aligned} \right. $$

For the first value of the parameter, only $x = 0$ is a solution of the equation.

For the second value of the parameter, solutions are $x = 0$ and $x = 2$.

Difficulty: EASY
Tags: Mathematics

Starter code:

Solutions:
def flip(x):
	return x & x - 1
t = int(input())
for i in range(t):
	x = int(input())
	ans = 1
	while x != 0:
		x = flip(x)
		ans *= 2
	print(ans)


t = int(input())
for i in range(t):
	print(2 ** bin(int(input())).count('1'))


t = int(input())
for tc in range(t):
	ans = bin(int(input())).count('1')
	print(2 ** ans)


t = int(input())
for i in range(t):
	c = 0
	a = bin(int(input()))
	for j in range(len(a)):
		if a[j] == '1':
			c += 1
	print(pow(2, c))


n = int(input())
numbers = []
for _ in range(n):
	numbers.append(int(input()))
for x in numbers:
	i = 1
	while x > 0:
		if x % 2 == 1:
			i *= 2
		x //= 2
	print(i)


tc = int(input())
for i in range(tc):
	n = int(input())
	a = bin(n).count('1')
	print(pow(2, a))


from sys import stdin, stdout

def countSetBits(n):
	count = 0
	while n:
		count += n & 1
		n >>= 1
	return count
t = int(stdin.readline())
while t > 0:
	a = int(stdin.readline())
	count = countSetBits(a)
	print(2 ** count)
	t -= 1


for t in range(int(input())):
	n = int(input())
	c = 0
	while n:
		if n % 2 == 1:
			c += 1
		n = n // 2
	print(2 ** c)


for _ in range(int(input())):
	print(pow(2, bin(int(input())).count('1')))


t = int(input())
for i in range(t):
	g = int(input())
	d = bin(g)
	s = d.count('1')
	print(2 ** s)


t = int(input())
for x in range(t):
	n = int(input())
	s = bin(n)[2:]
	c = s.count('1')
	print(2 ** c)


t = int(input())
for i in range(t):
	inp = int(input())
	cmp = 0
	for j in range(30):
		if inp & 1 << j:
			cmp += 1
	print(1 << cmp)


USE_STDIO = False
if not USE_STDIO:
	try:
		import mypc
	except:
		pass

def count_bits(x):
	ans = 0
	while x:
		ans += 1
		x &= x - 1
	return ans

def main():
	(t,) = list(map(int, input().split(' ')))
	for _ in range(t):
		(a,) = list(map(int, input().split(' ')))
		c = count_bits(a)
		ans = 1 << c
		print(ans)

def __starting_point():
	main()
__starting_point()


for _ in range(int(input())):
	print(1 << bin(int(input())).count('1'))


t = int(input())
for i in range(t):
	a = int(input())
	ans = 0
	p = 1
	while a:
		if a % 2 == 1:
			ans += p
			p *= 2
		a //= 2
	print(ans + 1)


n = int(input())
for i in range(n):
	a = int(input())
	s = bin(a)
	s = s[2:]
	co = s.count('1')
	print(2 ** co)


for t in range(int(input().strip())):
	a = int(input().strip())
	x = list(bin(a))
	zr = x[2:].count('0')
	idx1 = len(x) - 2
	print(pow(2, idx1 - zr))


t = int(input())
for i in range(t):
	c = int(input())
	cnt = 0
	while c > 0:
		cnt += c % 2
		c //= 2
	print(2 ** cnt)


t = int(input())
for l in range(t):
	n = int(input())
	s = bin(n)[2:]
	ans = s.count('1')
	print(2 ** ans)


t = int(input())
for i in range(t):
	n = int(input())
	t = '{0:b}'.format(n)
	one = t.count('1')
	print(2 ** one)


t = int(input())
for e in range(t):
	n = int(input())
	s1 = bin(n)[2:]
	one = s1.count('1')
	print(2 ** one)


import math
n = int(input())

def func(x):
	s = math.bin(x)
	return
for i in range(n):
	x = int(input())
	bn = bin(x)
	t = bn.count('1')
	print(2 ** t)


t = int(input())
for ijk in range(0, t):
	a = int(input())
	bi = bin(a)
	c = bi.count('1')
	print(pow(2, c))


def ans():
	n = int(input())
	c = bin(n).count('1')
	ans = pow(2, c)
	print(ans)
tc = int(input())
for _ in range(tc):
	ans()


for i in range(int(input())):
	a = int(input())
	m = bin(a)
	k = 1
	for i in m[2:]:
		if i == '1':
			k *= 2
	print(k)


t = int(input())
for I in range(t):
	n = int(input())
	print(2 ** bin(n)[2:].count('1'))


n = int(input())
arr = []
for i in range(n):
	arr.append(int(input()))
for a in arr:
	a_bin = [int(x) for x in bin(a)[2:]]
	print(2 ** sum(a_bin))


t = int(input())
for i in range(t):
	count = 1
	a = bin(int(input()))[2:]
	for j in range(len(a)):
		if a[j] == '1':
			count *= 2
	print(count)


def solve(x):
	k = 0
	while x > 0:
		if x % 2 == 1:
			k += 1
		x //= 2
	return 2 ** k
l = int(input())
ar = []
for i in range(l):
	ar.append(int(input()))
for i in range(l):
	print(solve(ar[i]))


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


t = int(input())
for i in range(t):
	a = str(bin(int(input())))
	k = 0
	for j in a:
		if j == '1':
			k = k + 1
	print(2 ** k)


t = int(input())
ansl = []
for i in range(t):
	a = int(input())
	ans = 1
	while a > 0:
		if a % 2 == 1:
			ans <<= 1
		a >>= 1
	ansl.append(ans)
print(*ansl, sep='\n')


import math

def getInts():
	return [int(n) for n in input().split()]

def findX(a):
	if a == 0:
		return 1
	bs = bin(a)
	bs = bs[2:]
	n = bs.count('1')
	return 2 ** n
n = int(input())
for i in range(n):
	a = int(input())
	print(findX(a))


def cnt_ones(n):
	res = 0
	while n > 0:
		n &= n - 1
		res += 1
	return res
t = int(input())
for _ in range(t):
	n = int(input())
	print(2 ** cnt_ones(n))


def count_setbits(n):
	count = 0
	while n > 0:
		n = n & n - 1
		count += 1
	return count
T = int(input())
while T > 0:
	a = int(input())
	print(2 ** count_setbits(a))
	T -= 1


t = int(input())
sol = []
for _ in range(t):
	a = int(input())
	x = bin(a).count('1')
	sol.append(2 ** x)
for _ in sol:
	print(_)


t = int(input())
r = []
for i in range(t):
	a = int(input())
	b = bin(a)
	s = str(b)
	temp = 1
	for j in range(len(s)):
		if s[j] == '1':
			temp *= 2
	r.append(str(temp))
print('\n'.join(r))


n = int(input())
for _ in range(n):
	s = bin(int(input()))
	print(2 ** s.count('1'))


n = int(input())
for i in range(n):
	temp = int(input())
	binary = bin(temp)[2:]
	p = binary.count('1')
	print(2 ** p)


t = int(input())
for _ in range(t):
	a = int(input())
	ans = 2 ** sum([a >> i & 1 for i in range(32)])
	print(ans)


t = int(input())
for _ in range(t):
	a = int(input())
	print(2 ** str(bin(a)).count('1'))


from typing import Dict, List

def get_results_count(a: int) -> int:
	ones_count = 0
	bin_a = a
	while bin_a > 0:
		if bin_a & 1:
			ones_count += 1
		bin_a = bin_a >> 1
	return 2 ** ones_count
input_count = int(input())
inputs = []
for _ in range(input_count):
	inputs.append(int(input()))
for input_val in inputs:
	print(get_results_count(input_val))


for i in range(int(input())):
	n = int(input())
	b = list(bin(n))[2:]
	ans = 1
	for i in b:
		if i == '1':
			ans *= 2
	print(ans)


for s in [*open(0)][1:]:
	print(1 << bin(int(s)).count('1'))


t = int(input())
for i in range(t):
	ans = 1
	a = bin(int(input()))[2:]
	for j in a:
		if j == '1':
			ans *= 2
	print(ans)


for _ in range(int(input())):
	a = int(input())
	b = bin(a)[2:].count('1')
	print(int('1' + '0' * b, 2))


def func(bin):
	bin = bin.lstrip('0')
	if bin == '':
		return '1'
	return func(bin[1:]) + '0'
t = int(input())
for _ in range(t):
	a = int(input())
	b = '{0:b}'.format(a)
	ans = int(func(b), 2)
	print(ans)


n = int(input())
s1 = 0
for i in range(n):
	m = int(input())
	m = bin(m)
	m = str(m)
	s = 0
	for j in range(len(m)):
		if m[j] == '1':
			s += 1
	print(2 ** s)


def main():
	T = int(input())
	for i in range(T):
		a = int(input())
		cnt = 0
		while a > 0:
			if a & 1:
				cnt += 1
			a >>= 1
		ans = 1
		for i in range(cnt):
			ans <<= 1
		print(ans)
main()


t = int(input())
for i in range(t):
	x = int(input())
	rahat = pow(2, bin(x).count('1'))
	print(rahat)


n = int(input())
for x in range(0, n, +1):
	a = int(input())
	sa = list(str(a.__format__('b')))
	count_sa = 0
	for y in sa:
		if y == '1':
			count_sa += 1
	print(2 ** count_sa)


import sys

def rint():
	return map(int, sys.stdin.readline().split())
t = int(input())
for i in range(t):
	a = int(input())
	bit = bin(a)
	print(2 ** bit.count('1'))


for _ in range(int(input())):
	n = int(input())
	s = bin(n)
	s = s[2:]
	c = 0
	for i in range(len(s)):
		if s[i] == '1':
			c += 1
	print(2 ** c)


n = int(input())
for i in range(n):
	print(2 ** bin(int(input())).count('1'))


import math

def countnum1(num):
	ans = 0
	while num > 0:
		if num & 1:
			ans += 1
		num >>= 1
	return ans
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	print(pow(2, countnum1(n)))


T = int(input())
for _ in range(T):
	a = int(input())
	b = bin(a)[2:]
	ways = 2 ** b.count('1')
	print(ways)


t = int(input())
while t > 0:
	n = int(input())
	x = bin(n).count('1')
	print(2 ** x)
	t = t - 1


import os
import sys
from io import BytesIO, IOBase
from math import pow

def __builtin_popcount(n):
	count = 0
	while n > 0:
		if n % 2 == 1:
			count += 1
		n = n // 2
	return count

def count_values(n):
	set_bits = __builtin_popcount(n)
	print(int(pow(2, set_bits)))

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		count_values(n)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for i in range(t):
	n = int(input())
	a = bin(n)[2:]
	b = a.count('1')
	c = 2 ** b
	print(c)


T = int(input())
for t in range(T):
	a = int(input())
	count = 0
	while a > 0:
		r = a % 2
		a = a // 2
		if r == 1:
			count += 1
	print(pow(2, count))


print('\n'.join([str(2 ** len([_ for i in str(bin(int(input())))[2:] if int(i)])) for _ in range(int(input()))]))


R = lambda : map(int, input().split())
t = int(input())
for _ in range(t):
	a = int(input())
	n = bin(a)[2:].count('1')
	print(2 ** n)


for _ in range(int(input())):
	my_int = int(input())
	s = '{0:#b}'.format(my_int)
	s = s[2:]
	ans = 0
	c = 0
	for i in range(len(s) - 1, -1, -1):
		if s[i] == '1':
			ans += pow(2, c)
			c += 1
	print(ans + 1)


def countSetBits(n):
	count = 0
	while n:
		n &= n - 1
		count += 1
	return count
t = int(input())
for i in range(t):
	n = int(input())
	c = 1
	n = countSetBits(n)
	for j in range(n):
		c *= 2
	print(c)


import math
t = int(input())
while t > 0:
	s = input()
	print(int(math.pow(2, str(bin(int(s))).count('1'))))
	t = t - 1


n = int(input())
for i in range(n):
	t = int(input())
	t = str(bin(t))
	t = t[t.index('b') + 1:]
	answer = 1
	for j in t:
		if j == '1':
			answer *= 2
	print(answer)


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


def pre_calc():
	c = [[0 for j in range(32)] for i in range(32)]
	c[0][0] = 1
	for i in range(1, 32):
		c[i][0] = 1
		for j in range(1, i):
			c[i][j] = c[i - 1][j - 1] + c[i - 1][j]
		c[i][i] = 1
	return c

def bits(a):
	cnt = 0
	for i in range(32):
		if a & 1 << i > 0:
			cnt += 1
	return cnt

def main():
	c = pre_calc()
	t = int(input())
	for i in range(t):
		a = int(input())
		cnt = bits(a)
		print(sum(c[cnt][:cnt + 1]))
main()


def A001316(n):
	return 2 ** bin(n)[2:].count('1')
t = int(input())
for i in range(t):
	n = int(input())
	print(A001316(n))


t = int(input())
for i in range(t):
	a = int(input())
	s = bin(a)[2:]
	ans = 1
	for c in s:
		if c == '1':
			ans *= 2
	print(ans)


from sys import stdin, stdout

def main():
	t = str(stdin.readline())
	for x in stdin.readlines():
		x = int(x)
		cnt = x & 1
		while x > 0:
			x = x >> 1
			cnt = cnt + x % 2
		stdout.write(str(1 << cnt) + '\n')
main()


from sys import stdin

def diff(n):
	count = 0
	while n:
		if n & 1 == 1:
			count += 1
		n = n >> 1
	return 1 << count
n = int(stdin.readline())
for i in range(n):
	t = int(stdin.readline())
	print(diff(t))


import math
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	print(pow(2, bin(n).count('1')))


t = int(input())
for i in range(t):
	num = int(input())
	num2 = bin(num)[2:]
	num3 = num2.count('1')
	print(2 ** num3)


def onbits(x):
	return bin(x).count('1')
for _ in range(int(input())):
	n = int(input())
	print(2 ** onbits(n))


for _ in range(int(input())):
	n = int(input())
	if n == 0:
		print(1)
		continue
	bn = bin(n)[2:]
	a = 0
	for i in range(len(bn)):
		if bn[i] == '1':
			a += 1
	print(2 ** a)


t = int(input())
for i in range(t):
	a = int(input())
	print(2 ** sum([int(i) for i in bin(a)[2:]]))


T = int(input())
for t in range(T):
	a = int(input())
	cnt = 0
	while a != 0:
		if a % 2 == 1:
			cnt += 1
		a >>= 1
	print(1 << cnt)


def to_bin(n):
	cnts = 0
	while n != 0:
		if n % 2 == 1:
			cnts += 1
		n = n // 2
	return cnts
t = int(input())
for _ in range(t):
	cnt = to_bin(int(input()))
	print(2 ** cnt)


from sys import stdin, stdout
t = int(stdin.readline().strip())
lines = stdin.readlines()
for line in lines:
	a = int(line.strip())
	s = bin(a)
	cnt = 0
	for i in s[2:]:
		if i == '1':
			cnt += 1
	stdout.write(str(2 ** cnt) + '\n')


t = int(input())
for i in range(t):
	a = int(input())
	res = 1
	while a > 0:
		if a % 2:
			res <<= 1
		a >>= 1
	print(res)


def problem(a):
	bin_num = str(bin(a))
	total = 0
	for el in bin_num:
		if el == '1':
			total += 1
	return 2 ** total
t = int(input())
res = ''
for i in range(t):
	a = int(input())
	res += str(problem(a))
	if i < t - 1:
		res += '\n'
print(res)


def go(a):
	if a == 0:
		return 1
	else:
		return 2 ** '{0:b}'.format(a).count('1')
t = int(input())
for a in range(t):
	a = int(input())
	print(go(a))


from sys import stdin, stdout
import cProfile, math
from collections import Counter
printHeap = str()
test = False
memory_constrained = False

def display(string_to_print):
	stdout.write(str(string_to_print) + '\n')

def test_print(output):
	if test:
		stdout.write(str(output) + '\n')

def display_list(list1, sep=' '):
	stdout.write(sep.join(map(str, list1)) + '\n')

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))
memory = dict()

def clear_cache():
	global memory
	memory = dict()

def cached_fn(fn, *args):
	global memory
	if args in memory:
		return memory[args]
	else:
		result = fn(*args)
		memory[args] = result
		return result

def main():
	for _ in range(get_int()):
		n = get_int()
		n = str(bin(n)).count('1')
		print(2 ** n)
cProfile.run('main()') if test else main()


from sys import stdin

def readLine():
	return stdin.readline()

def readInt():
	return int(readLine())
f = lambda a, x: a - (a ^ x) - x

def main():
	n = readInt()
	for i in range(n):
		a = readInt()
		bn = bin(a)[2:]
		ans = 1
		for i in bn:
			if i == '1':
				ans *= 2
		print(ans)
main()


import math
t = input()
t = int(t)

def dec_to_bin(x):
	return int(bin(x)[2:])
for i in range(t):
	a = int(input())
	stroka = str(dec_to_bin(a))
	num = stroka.count('1')
	print(2 ** num)


y = int(input())
let = []
for i in range(y):
	n = int(input())
	x = bin(n)
	z = 0
	line = list(str(x))
	for i in line:
		if i == '1':
			z = z + 1
	let.append(2 ** z)
for i in let:
	print(i)


for _ in range(int(input())):
	m = int(input())
	a = list(map(int, bin(m)[2:]))
	c = a.count(1)
	print(1 << c)


def countSetBits(n):
	if n == 0:
		return 0
	else:
		return (n & 1) + countSetBits(n >> 1)
t = int(input())
for _ in range(0, t):
	a = int(input())
	x = countSetBits(a)
	print(pow(2, x))


def countSetBits(n):
	count = 0
	while n:
		n &= n - 1
		count += 1
	return count
for _ in range(int(input())):
	n = int(input())
	k = countSetBits(n)
	print(pow(2, k))


t = int(input())
for i in range(t):
	a = int(input())
	b = format(a, 'b')
	ans = 1
	for c in b:
		if c == '1':
			ans *= 2
	print(ans)


from sys import stdin
all_in = stdin.readlines()
t = int(all_in[0])
a = list(map(int, all_in[1:]))
print('\n'.join(map(lambda el: str(2 ** bin(el).count('1')), a)))


for _ in range(int(input())):
	print(2 ** f'{int(input()):b}'.count('1'))


from math import log

def a(n):
	if n == 0:
		return 1
	if n == 1:
		return 2
	power_of_two = 1
	while power_of_two < n:
		power_of_two *= 2
	if power_of_two > n:
		power_of_two //= 2
	return 2 * a(n - power_of_two)
t = int(input())
for test in range(0, t):
	A = int(input())
	print(a(A))


for _ in range(int(input())):
	x = bin(int(input()))
	b = x.count('1')
	print(1 << b)


t = int(input())
for _ in range(t):
	a = int(input())
	ans = 1
	while a:
		if a % 2 == 1:
			ans *= 2
		a //= 2
	print(ans)


def countSetBits(num):
	binary = bin(num)
	setBits = [ones for ones in binary[2:] if ones == '1']
	return len(setBits)
t = int(input())
for _ in range(t):
	n = int(input())
	x = countSetBits(n)
	print(2 ** x)


T = int(input())
for t in range(T):
	a = int(input())
	cnt = 1
	b = bin(a)[2:]
	for s in b:
		if s == '1':
			cnt *= 2
	print(cnt)


t = int(input())
for i in range(t):
	n = int(input())
	a = bin(n)[2:]
	print(2 ** sum([1 for j in a if j == '1']))


for i in range(int(input())):
	n = int(input())
	s = bin(n)
	s = s[2:]
	z = s.count('1')
	print(pow(2, z))


def operation(a):
	num = 0
	while a != 0:
		if a % 2 == 1:
			a = a // 2
			num += 1
		else:
			a = a / 2
	return 2 ** num
t = int(input())
arr = []
for i in range(t):
	a = int(input())
	arr.append(operation(a))
for i in range(t):
	print(arr[i])


def kps(n):
	r = 1
	if n == 0:
		return 1
	while n > 0:
		if n % 2 == 1:
			r *= 2
		n = n // 2
	else:
		return r
for i in range(int(input())):
	a = int(input())
	print(kps(a))


T = int(input())
for cas in range(T):
	n = int(input())
	ans = 0
	for i in range(31):
		if n & 1 << i:
			ans += 1
	print(1 << ans)


t = int(input())
for _ in range(t):
	n = int(input())
	k = bin(n)
	l = k.count('1')
	print(pow(2, l))


from sys import stdin
for test_case in range(int(stdin.readline())):
	a = list(bin(int(stdin.readline())))
	print(2 ** a[2:].count('1'))


t = int(input())
for q in range(t):
	a = int(input())
	b = bin(a)[2:]
	s = b.count('1')
	print(1 << s)


def go():
	t = int(input())
	for i in range(t):
		a = int(input())
		print(2 ** bin(a).count('1'))
go()


t = int(input())
while t:
	t -= 1
	a = int(input())
	c = bin(a)[2:]
	if a == 0:
		print(1)
		continue
	print(pow(2, c.count('1')))


import sys

def minp():
	return sys.stdin.readline().strip()
t = int(minp())
for i in range(t):
	a = int(minp())
	c = 0
	while a > 0:
		if a & 1 != 0:
			c += 1
		a >>= 1
	print(2 ** c)


import sys

class Main:

	def __init__(self):
		self.buff = None
		self.index = 0

	def next(self):
		if self.buff is None or self.index == len(self.buff):
			self.buff = sys.stdin.readline().split()
			self.index = 0
		val = self.buff[self.index]
		self.index += 1
		return val

	def next_int(self):
		return int(self.next())

	def solve(self):
		for i in range(0, self.next_int()):
			t = self.next_int()
			a = 1
			while t > 0:
				if t & 1 == 1:
					a <<= 1
				t >>= 1
			print(a)
Main().solve()


n = int(input())
for i in range(0, n):
	z = int(input())
	ones = bin(z).count('1')
	print(2 ** ones)


T = int(input())
for _ in range(T):
	a = int(input())
	n = bin(a).count('1')
	print(2 ** n)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	s = str(bin(n))
	cnt = 0
	for ch in s:
		if ch == '1':
			cnt += 1
	ans = ''
	if cnt == 0:
		ans = '0'
	else:
		for i in range(0, cnt):
			ans += '1'
	print(int(ans, 2) + 1)


def count_one(n):
	count = 0
	while n:
		n = n & n - 1
		count += 1
	return count
for _ in range(int(input())):
	a = int(input())
	ones = count_one(a)
	print(2 ** ones)


import math

def bitsoncount(x):
	b = 0
	while x > 0:
		x &= x - 1
		b += 1
	return b
t = int(input())
res = []
for _ in range(t):
	a = int(input())
	res.append(bitsoncount(a))
for x in res:
	print(int(math.pow(2, x)))


t = int(input())

def st(x):
	ot = 0
	while x != 0:
		ot += x % 2
		x //= 2
	return ot
for i in range(t):
	f = int(input())
	print(2 ** st(f))


n = int(input())
for i in range(n):
	x = int(input())
	ans = 1
	for j in range(33):
		if 1 << j & x:
			ans *= 2
	print(ans)


def count(n):
	c = 0
	while n:
		n &= n - 1
		c += 1
	return c
for _ in range(int(input())):
	print(pow(2, count(int(input()))))


def count_ones(x):
	ans = 0
	while x > 0:
		if x % 2 == 1:
			ans = ans + 1
		x = x // 2
	return ans
t = int(input())
for i in range(t):
	a = int(input())
	y = count_ones(a)
	print(2 ** y)


from math import log2, ceil
for i in range(int(input())):
	n = int(input())
	print(pow(2, bin(n).count('1')))


def solve(x):
	answer = 1
	while x > 0:
		if x & 1 == 1:
			answer *= 2
		x >>= 1
	return answer
test_count = int(input())
for x in range(test_count):
	print(solve(int(input())))


n = int(input())
a = []
b = 0
for i in range(n):
	a.append(int(input()))
for i in range(n):
	print(2 ** bin(a[i]).count('1'))


t = int(input())
for i in range(t):
	z = int(input())
	ans = 0
	while z > 0:
		ans += z % 2
		z //= 2
	print(2 ** ans)


n = int(input())
for i in range(n):
	b = bin(int(input()))
	count = 0
	for c in b:
		if c == '1':
			count += 1
	print(pow(2, count))


t = int(input())
for i in range(t):
	a = int(input())
	d = 0
	while a >= 1:
		if a % 2 == 0:
			a = a / 2
		else:
			a = (a - 1) / 2
			d = d + 1
	print(2 ** d)


n = int(input(''))
l = []
for k in range(n):
	b = int(input(''))
	l.append(b)
final = []
for i in l:
	c = 0
	while i > 0:
		if i % 2 == 1:
			c = c + 1
		i = int(i / 2)
	final.append(c)
for j in final:
	print(2 ** j)


t = int(input())
for q in range(t):
	a = int(input())
	bt = 0
	while a > 0:
		bt += a & 1
		a >>= 1
	print(2 ** bt)


t = int(input())
for _ in range(t):
	n = int(input())
	ans = 0
	for i in range(32):
		if n & 1 << i:
			ans += 1
	ans = 1 << ans
	print(ans)


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	b = bin(n)[2:]
	count = 0
	for c in b:
		if c == '1':
			count += 1
	print(2 ** count)


def conjecture(i):
	if i == 0:
		return 1
	b = '{:b}'.format(i)
	num_ones = b.count('1')
	return 2 ** num_ones
import sys
if sys.version_info < (3, 0):
	input = raw_input
N = int(input())
for _ in range(N):
	x = int(input())
	print(conjecture(x))


t = int(input())
for _ in range(t):
	x = int(input())
	res = 0
	while x:
		res += x & 1
		x >>= 1
	print(1 << res)


T = int(input())
for t in range(T):
	a = 1 << bin(int(input())).count('1')
	print(a)


t = int(input())
answers = []
for _ in range(t):
	a = int(input())
	ans = 2 ** bin(a)[2:].count('1')
	answers.append(ans)
print(*answers, sep='\n')


import math

def binary(num):
	s = ''
	while num > 0:
		if num % 2 == 0:
			s = '0' + s
		if num % 2 == 1:
			s = '1' + s
		num = num // 2
	return s
t = int(input())
for i in range(t):
	n = int(input())
	if n == 0:
		print(1)
	else:
		print(pow(2, binary(n).count('1')))


import math
n = int(input())
for i in range(n):
	c = int(input())
	s = 0
	while c != 0:
		if c & 1 == 1:
			s += 1
		c >>= 1
	print(2 ** s)


t = int(input())
for i in range(0, t):
	num = int(input())
	j = 0
	ans = 1
	while True:
		if 1 << j > num:
			break
		if num & 1 << j:
			ans *= 2
		j += 1
	print(ans)


from sys import stdin, stdout
T = int(input())
for i in range(T):
	num = int(input())
	s = '{0:b}'.format(num)
	res = 1
	for d in s:
		if d == '1':
			res *= 2
	print(res)


def czero(a):
	co = 0
	while a:
		if a & 1:
			co += 1
		a >>= 1
	return co

def coxor(a):
	co = czero(a)
	return 1 << co
for _ in range(int(input())):
	a = int(input())
	print(coxor(a))


n = int(input())
for _ in range(n):
	print(2 ** len([x for x in bin(int(input())) if x == '1']))


import sys
T = int(sys.stdin.readline().strip('\n'))
for t in range(T):
	a = 1 << bin(int(input())).count('1')
	print(a)


m = int(input())
for i in range(m):
	print(2 ** bin(int(input())).count('1'))


t = int(input())
for i in range(t):
	n = int(input())
	sum = 0
	while n > 0:
		if n % 2 == 1:
			sum += 1
		if n != 2:
			n //= 2
		else:
			sum += 1
			break
	print(2 ** sum)


input = __import__('sys').stdin.readline
print = __import__('sys').stdout.write
for _ in range(int(input())):
	c = 0
	n = int(input())
	while n:
		c += n & 1
		n >>= 1
	print(str(2 ** c) + '\n')


import os
import sys
from io import BytesIO, IOBase
import math
from queue import Queue
import collections
import itertools
import bisect
import heapq
import random

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def lis(arr):
	n = len(arr)
	lis = [1] * n
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
	maximum = 0
	for i in range(n):
		maximum = max(maximum, lis[i])
	return maximum

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def maxfac(n):
	root = int(n ** 0.5)
	for i in range(2, root + 1):
		if n % i == 0:
			return n // i
	return n

def p2(n):
	c = 0
	while n % 2 == 0:
		n //= 2
		c += 1
	return c

def seive(n):
	primes = [True] * (n + 1)
	primes[1] = primes[0] = False
	i = 2
	while i * i <= n:
		if primes[i] == True:
			for j in range(i * i, n + 1, i):
				primes[j] = False
		i += 1
	pr = []
	for i in range(0, n + 1):
		if primes[i]:
			pr.append(i)
	return pr

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def denofactinverse(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return pow(fac, m - 2, m)

def numofact(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return fac

def sod(n):
	s = 0
	while n > 0:
		s += n % 10
		n //= 10
	return s
for xyz in range(0, int(input())):
	n = int(input())
	t = binary(n)
	c = t.count('1')
	print(2 ** c)


def binary(n):
	return bin(n)[2:]
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	s = bin(n)
	c = s.count('1')
	print(pow(2, c) // 1)


t = int(input())
for i in range(t):
	a = int(input())
	num = 1
	for j in range(30):
		if a & 1 << j:
			num *= 2
	print(num)


tc = int(input())
for i in range(tc):
	x = int(input())
	b = bin(x)[2:]
	b = str(b).count('1')
	print(2 ** b)


import math
t = int(input())
for i in range(t):
	a = int(input())
	print(2 ** bin(a).count('1'))


def count(a):
	digits = list(bin(a)[2:])
	rows_count = 2 ** len(digits)
	count_ = rows_count
	for digit in digits:
		if digit == '0':
			count_ = count_ / 2
	return int(count_)
n = int(input())
for i in range(n):
	a = int(input())
	print(count(a))


t = int(input())
A = [0] * t
for i in range(t):
	A[i] = int(input())
for i in range(t):
	x = A[i]
	s = 1
	while x > 1:
		if x % 2 == 1:
			s += 1
		x //= 2
	print(1 if x == 0 else 2 ** s)


t = int(input())
for i in range(t):
	s = int(input())
	if s == 0:
		print(1)
		continue
	else:
		s = bin(s)
	r = s.count('1')
	ans = int(r * '1', 2) + 1
	print(ans)


import os, sys
from io import BytesIO, IOBase
from types import GeneratorType
from bisect import *
from collections import defaultdict, deque, Counter
import math, string
from heapq import *
from operator import add
from itertools import accumulate
BUFSIZE = 8192
sys.setrecursionlimit(10 ** 5)

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
inf = float('inf')
en = lambda x: list(enumerate(x))
ceil_ = lambda a, b: (a + b - 1) // b
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())

def solve():
	n = ii()
	print(1 << bin(n)[2:].count('1'))
for _ in ' ' * ii():
	solve()


com = [[0 for j in range(31)] for i in range(31)]

def main():
	t = int(input())
	for i in range(31):
		com[i][0] = 1
	for i in range(1, 31):
		for j in range(1, 31):
			com[i][j] = com[i - 1][j] + com[i - 1][j - 1]
	for i in range(t):
		a = int(input())
		cnt = 0
		while a:
			if a & 1:
				cnt += 1
			a >>= 1
		ans = 0
		for i in range(cnt + 1):
			ans += com[cnt][i]
		print(ans)
main()


for _ in range(int(input())):
	n = int(input())
	m = bin(n).split('b')[1]
	p = m.count('1')
	print(pow(2, p))


t = int(input())
for i in range(t):
	a = int(input())
	cnt = 0
	while a:
		cnt += a & 1
		a >>= 1
	print(1 << cnt)


t = int(input())
while t:
	print(2 ** bin(int(input())).count('1'))
	t -= 1


gi = lambda : list(map(int, input().split()))
print('\n'.join(list(map(str, [2 ** bin(gi()[0])[2:].count('1') for e in range(gi()[0])]))))


from collections import Counter
n = int(input())
A = []
for _ in range(n):
	A.append(int(input()))
for a in A:
	if a == 0:
		print(1)
	else:
		a_bin = bin(a)
		counter = Counter(a_bin)
		count_ones = counter['1']
		print(2 ** count_ones)


import time
t = int(input())
start = time.time()
ans = [1] * t
for i in range(t):
	a = bin(int(input()))[2:]
	for j in a:
		if j == '1':
			ans[i] *= 2
for i in ans:
	print(i)
finish = time.time()


def solve():
	a = int(input())
	print(2 ** bin(a)[2:].count('1'))
for _ in range(int(input())):
	solve()


for i in range(int(input())):
	number = int(input())
	cout = 0
	while number > 0:
		if number % 2 == 1:
			cout += 1
		number //= 2
	print(2 ** cout)


n = int(input())
s = []
while n:
	m = int(input())
	a = bin(m)
	a = a[2:]
	a = list(a)
	c = 0
	for i in a:
		if i == '1':
			c += 1
	print(2 ** c)
	n -= 1


t = int(input())
for _ in range(t):
	num = int(input())
	ans = 1
	while num // 2:
		ans *= num % 2 + 1
		num = num // 2
	print(ans * (num + 1))


for i in [int(input()) for _ in range(int(input()))]:
	print(2 ** len([1 for i in str(bin(i))[2:] if int(i)]))


import math
c = int(input())
for i in range(c):
	a = int(input())
	s = 0
	while a > 0:
		s += a % 2
		a //= 2
	print(2 ** s)


import sys, collections, math, itertools, random, bisect
INF = sys.maxsize

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
mod = 1000000007
for _ in range(int(input())):
	a = int(input())
	print(1 << bin(a)[2:].count('1'))


def readint():
	return int(input())

def readline():
	return [int(c) for c in input().split()]

def main():
	T = readint()
	for i in range(T):
		a = readint()
		res = 1
		pos = 1
		if a == 0:
			print(1)
		else:
			ans = a
			while a > 0:
				if a & 1 == 1:
					res *= 2
				a >>= 1
				pos += 1
			print(res)
main()


t = int(input())
for i in range(0, t):
	a = int(input())
	a = bin(a)
	print(pow(2, a.count('1')))


tests = int(input())
for i in range(0, tests):
	a = int(input())
	one_count = 0
	for i in range(30):
		if 1 & a >> i == 1:
			one_count += 1
	print(pow(2, one_count))


t = int(input())
for i in range(t):
	g = int(input())
	d = 0
	while g > 0:
		d += g % 2
		g //= 2
	print(2 ** d)


def solve(n):
	res = 0
	for x in range(n + 1):
		if n ^ x == n - x:
			res += 1
	return res

def solve_1(n):
	cnt = 0
	while n:
		if n % 2 == 1:
			cnt += 1
		n = n // 2
	return 2 ** cnt
t = int(input())
while t:
	n = int(input())
	print(solve_1(n))
	t -= 1


def main():
	for i in range(int(input())):
		n = int(input())
		if n == 0:
			print(1)
			continue
		c = bin(n)
		n = c.count('1')
		print(2 ** n)
main()


import sys
import math
t = int(input())
for _ in range(t):
	a = int(input())
	abin = bin(a)
	dec = str(abin)
	one = dec.count('1')
	print(pow(2, one))


n = int(input())
for i in range(n):
	a = int(input())
	ba = bin(a)
	ans = 0
	for elem in ba:
		if elem == '1':
			ans += 1
	print(2 ** ans)


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	s = bin(n)[2:]
	c = s.count('1')
	print(2 ** c)


import sys
import string
from math import gcd
import getpass
import math
from decimal import Decimal

def ria():
	return [int(i) for i in input().split()]
if getpass.getuser() != 'frohenk':
	filename = 'half'
else:
	sys.stdin = open('input.txt')
n = ria()[0]
for i in range(n):
	print(2 ** str(bin(int(input()))).count('1'))


step = []
i = 1
per = [1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4]
while i < 2 ** 31 - 1:
	step.append(i)
	i *= 2
t = int(input())
for i in range(t):
	a = int(input())
	if a == 0:
		print(1)
	elif a in step:
		print(2)
	else:
		steps = 0
		while a > 10:
			if a % 2 == 0:
				a /= 2
			else:
				a -= 1
				steps += 1
		print(per[int(a)] * 2 ** steps)


import sys, bisect
tc = int(sys.stdin.readline())
for _ in range(tc):
	a = int(sys.stdin.readline())
	res = bin(a).replace('0b', '')
	idx = res.count('1')
	print(pow(2, idx))


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
N = int(input())
for i in range(N):
	V = int(input())
	V = bin(V)[2:]
	res = 2 ** sum([int(x) for x in V])
	print(res)


_ = int(input())
while _ > 0:
	_ -= 1
	__ = int(input())
	___ = str(bin(__))
	____ = 0
	for ch in ___:
		if ch == '1':
			____ += 1
	_______ = ''
	if ____ == 0:
		_______ = '0'
	else:
		for i in range(0, ____):
			_______ += '1'
	print(int(_______, 2) + 1)


t = int(input())
for i in range(0, t):
	print(1 << str(bin(int(input()))).count('1'))


def main():
	T = int(input())
	for t in range(T):
		n = int(input())
		numOnes = '{0:b}'.format(n).count('1')
		print(1 << numOnes)
main()


def binary(x):
	t = x
	l = []
	while t != 0:
		l.append(str(t % 2))
		t = t // 2
	l.reverse()
	l = ''.join(l)
	return l
n = int(input())
for i in range(n):
	a = int(input())
	k = str(binary(a))
	ans = k.count('1')
	print(pow(2, ans))


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
t = ii()
for _ in range(t):
	print(2 ** bin(ii()).count('1'))


def rec(a):
	if a < 2:
		return a + 1
	h = 1
	cnt = 0
	while h <= a:
		h *= 2
		cnt += 1
	return rec(a % 2 ** (cnt - 1)) * 2
n = int(input())
for i in range(n):
	a = int(input())
	print(rec(a))


t = int(input())
while t > 0:
	n = int(input())
	s = bin(n)
	c1 = s.count('1')
	print(1 << c1)
	t -= 1


t = int(input())
for _ in range(t):
	num = int(input())
	if num == 0:
		print(1)
	else:
		print(2 ** bin(num).count('1'))


n = int(input())
t = []
for _ in range(n):
	t.append(int(input()))
for i in t:
	a = 0
	while i >= 1:
		if i % 2 == 0:
			i = i / 2
		else:
			i = (i - 1) / 2
			a += 1
	print(2 ** a)


def solve(a):
	binary = f'{a:b}'
	return 2 ** binary.count('1')
n = int(input())
for i in range(n):
	a = int(input())
	print(solve(a))


from sys import stdin, stdout, exit, setrecursionlimit

def sin():
	return stdin.readline().rstrip()

def listInput():
	return list(map(int, sin().split()))

def printBS(li):
	if not li:
		return
	for i in range(len(li) - 1):
		stdout.write('%d ' % li[i])
	stdout.write('%d\n' % li[-1])
t = int(sin())
for _ in range(t):
	a = int(sin())
	s = str(bin(a))[2:]
	print(2 ** s.count('1'))


t = int(input())
numbers = []
for _ in range(t):
	numbers.append(int(input()))
for idx in range(t):
	(x, num) = (0, numbers[idx])
	while num:
		x += num & 1
		num = num >> 1
	print(1 << x, end='\n')


t = int(input())
a_list = [int(input()) for x in range(t)]
for x in a_list:
	exponent = 0
	while x > 0:
		if x % 2 == 1:
			exponent += 1
		x //= 2
	print(2 ** exponent)


from sys import stdin, stdout
stdout.write('\n'.join([str(1 << bin(int(stdin.readline())).count('1')) for i in range(int(stdin.readline()))]))


t = int(input())
s = 2 ** 30
while t > 0:
	t -= 1
	n = int(input())
	s = bin(n)
	l = s.count('1')
	print(2 ** l)


t = int(input())
while t:
	t -= 1
	n = int(input())
	n = bin(n)[2:]
	n = n[::-1]
	ans = 1
	length = len(n)
	for x in range(length):
		if n[x] == '1':
			ans *= 2
	print(ans)


t = int(input())
a = []
for i in range(t):
	q = int(input())
	a.append(q)
for i in range(t):
	out = 1
	x = bin(a[i])
	x = x[2:]
	for j in x:
		if j == '1':
			out = out * 2
	print(out)


t = int(input())
for i in range(t):
	cnt = 0
	x = y = int(input())
	while x != 0:
		mod = int(x % 2)
		x /= 2
		if mod == 1:
			cnt += 1
	print(2 ** cnt)


import math

def f(s):
	ans = 0
	while s:
		if s & 1:
			ans += 1
		s = s >> 1
	return ans
n = int(input())
for x in range(n):
	s = int(input())
	bits = f(s)
	print(2 ** bits)


def func(n):
	if n == 0:
		return 1
	if n == 1:
		return 2
	if n % 2 == 1:
		return 2 * func(n // 2)
	if n % 2 == 0:
		return func(n // 2)
t = int(input())
while t:
	a = int(input())
	c = func(a)
	print(c)
	t -= 1


from functools import reduce
for i in range(int(input())):
	a = bin(int(input()))
	r = 1
	for i in a[2:]:
		r *= 2 if i == '1' else 1
	print(r)


for i in range(int(input())):
	print(pow(2, bin(int(input())).count('1')))


t = int(input())
a = [None] * t
for x in range(t):
	a[x] = int(input())

def power(a):
	te = bin(a)
	t = 0
	for x in te:
		if x == '1':
			t = t + 1
	return t
for x in range(t):
	ress = power(a[x])
	print(2 ** ress)


t = int(input())
while t:
	count = 0
	a = int(input())
	while a > 0:
		if a & 1:
			count += 1
		a = a >> 1
	print(2 ** count)
	t -= 1


def countOfZ(n):
	res = 0
	while n > 0:
		res += n % 2
		n = int(n / 2)
	return res

def C(n, k):
	a = k + 1
	b = n - k
	r1 = 1
	r2 = 1
	for i in range(a, n + 1):
		r1 *= i
	for i in range(1, b + 1):
		r2 *= i
	return int(r1 / r2)
t = int(input())
for i in range(t):
	a = int(input())
	c = countOfZ(a)
	res = 0
	for i in range(c + 1):
		res += C(c, i)
	print(res)