Watson gives an integer $N$ to Sherlock and asks him: What is the number of divisors of $N$ that are divisible by 2?.    

Input Format 

First line contains $\mathbf{T}$, the number of testcases. This is followed by $\mathbf{T}$ lines each containing an integer $N$.   

Output Format 

For each testcase, print the required answer in one line.      

Constraints 

$1\leq T\leq100$ 

$1\leq N\leq10^9$  

Sample Input  

2
9
8

Sample Output   

0
3

Explanation 

9 has three divisors 1, 3 and 9 none of which is divisible by 2. 

8 has four divisors 1,2,4 and 8, out of which three are divisible by 2.

Source: hackerrank | Difficulty: EASY
Tags: Mathematics


Solutions:
even = lambda x: x & 1 == 0

def f(x):
	div = 1
	ret = 0
	while div * div < x:
		if x % div == 0:
			if even(div):
				ret += 1
			if even(x // div):
				ret += 1
		div += 1
	if div * div == x and even(div):
		ret += 1
	return ret
t = int(input())
for _ in range(t):
	print(f(int(input())))


def do(n):
	if n == 1:
		return 1
	else:
		tais = [1, n]
		regulars = 2
		rootn = n ** 0.5
		while regulars < rootn:
			if n % regulars == 0:
				tais.append(regulars)
				tais.append(n / regulars)
			regulars += 1
		if rootn == regulars:
			tais.append(regulars)
			tais.sort()
		return len(tais)
sa = int(input())
for tai in range(sa):
	sa2 = int(input())
	if sa2 % 2 == 1:
		print(0)
	else:
		print(do(int(sa2 / 2)))


import math

def factors(n):
	fact = [1, n]
	check = 2
	rootn = math.sqrt(n)
	while check < rootn:
		if n % check == 0:
			fact.append(check)
			fact.append(n / check)
		check += 1
	if rootn == check:
		fact.append(check)
	return [x for x in fact if x % 2 == 0]
amount = int(input())
for x in range(amount):
	print(len(factors(int(input()))))


T = int(input())
for t in range(T):
	N = int(input())
	if N % 2 != 0:
		print(0)
		continue
	p = 2
	ans = 1
	while p * p <= N:
		k = 0
		while N % p == 0:
			N //= p
			k += 1
		ans *= k + 1 if p != 2 else k
		p += 1
	if N > 2:
		ans *= 2
	print(ans)


import functools, math, operator as op, sys

def is_prime(n):
	if n < 2:
		return False
	elif n == 2 or n == 3 or n == 5:
		return True
	elif n % 2 == 0 or n % 3 == 0 or n % 5 == 0:
		return False
	i = 6
	sqrt_n = int(math.ceil(math.sqrt(n)))
	while i <= sqrt_n + 1:
		if n % (i - 1) == 0 or n % (i + 1) == 0:
			return False
		i += 6
	return True

def prime_factors(n):
	factors = {}
	if n <= 1:
		return {}
	while n != 1:
		if is_prime(n):
			factors[n] = 1
			break
		i = 2
		while i <= n:
			j = 0
			while n % i == 0 and n != 1:
				j += 1
				n //= i
			if j > 0:
				factors[i] = j
				break
			i += 1
	return factors

def tau(n):
	return functools.reduce(op.mul, (v + 1 for v in prime_factors(n).values()), 1)
T = int(sys.stdin.readline())
for _ in range(T):
	N = int(sys.stdin.readline())
	print(tau(N // 2) if N % 2 == 0 else 0)


from sys import stdin
T = int(stdin.readline())
for _ in range(T):
	N = int(stdin.readline())
	a = 0
	for i in range(1, int(N ** 0.5 + 1)):
		if N % i == 0:
			if i % 2 == 0:
				a += 1
			if N // i % 2 == 0 and i * i != N:
				a += 1
	print(a)


import functools

def factors(n):
	return set(functools.reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
T = int(input())
for i in range(T):
	n = int(input())
	print(sum((1 for x in factors(n) if x % 2 == 0)))


from math import sqrt

def main():
	t = input()
	t = int(t)
	count = 0
	for x in range(t):
		n = int(input())
		a = prime(n)
		b = factorize(n, a)
		c = divisors(b)
		for x in c:
			if x % 2 == 0:
				count += 1
		print(count)
		count = 0

def prime(n):
	prm = []
	if n % 2 == 0:
		prm.append(2)
	while n % 2 == 0:
		n = n / 2
	for x in range(3, int(sqrt(n)) + 1, 2):
		if n % x == 0:
			prm.append(x)
		while n % x == 0:
			n = n / x
	if n > 2:
		prm.append(int(n))
	return prm

def factorize(n, primes):
	factors = []
	for p in primes:
		if p * p > n:
			break
		i = 0
		while n % p == 0:
			n //= p
			i += 1
		if i > 0:
			factors.append((p, i))
	if n > 1:
		factors.append((n, 1))
	return factors

def divisors(factors):
	div = [1]
	for (p, r) in factors:
		div = [d * p ** e for d in div for e in range(r + 1)]
	return div
main()


from math import sqrt

def divtest(n):
	divlist = []
	i = 1
	while i <= sqrt(n):
		if n % i == 0:
			if i % 2 == 0:
				divlist.append(i)
			if n / i % 2 == 0:
				divlist.append(n / i)
		i += 1
	return set(divlist)
t = int(input())
for _ in range(t):
	n = int(input())
	print(len(divtest(n)))


test = int(input())
import math
for t in range(test):
	n = int(input())
	c = 0
	while n % 2 == 0:
		n = n / 2
		c = c + 1
	if c == 0:
		print('0')
		continue
	k = 3
	x = {}
	while k <= int(math.sqrt(n)):
		while n % k == 0:
			n = n / k
			x[k] = x.get(k, 0) + 1
		k = k + 2
	if n > 2:
		x[n] = x.get(n, 0) + 1
	for i in x.keys():
		c = c * (x[i] + 1)
	print(int(c))


def tau(n):
	(d, ret) = (1, 0)
	while d * d <= n:
		if n % d == 0:
			ret += 1
		if n % d == 0 and d != n // d:
			ret += 1
		d += 1
	return ret
for _ in range(int(input())):
	n = int(input())
	print(0 if n % 2 == 1 else tau(n // 2))


def getPrimesUnder(n):
	if n < 3:
		return []
	n2 = n >> 1
	yield 2
	Ns = [True] * n2
	Ns[0] = False
	for i in range(1, n2):
		if Ns[i]:
			p = (i << 1) + 1
			if p * p > n:
				break
			yield p
			for m in range(i * (i + 1) << 1, n2, p):
				Ns[m] = False
	for i in range(i, n2):
		if Ns[i]:
			yield ((i << 1) + 1)
Ps = list(getPrimesUnder(31623))

def factorize(n):
	F = []
	for p in Ps:
		if p * p > n:
			break
		count = 0
		(d, r) = divmod(n, p)
		while r == 0:
			n = d
			(d, r) = divmod(n, p)
			count += 1
		if count > 0:
			F.append((p, count))
	if n > 1:
		F.append((n, 1))
	return F

def solve(N):
	if N % 2 != 0:
		return 0
	F = factorize(N // 2)
	p = 1
	for f in F:
		p *= f[1] + 1
	return p
T = int(input())
for _ in range(T):
	print(solve(int(input())))


from math import floor, ceil, sqrt

def factorization(n):
	sqroot = floor(sqrt(n)) + 1
	f = {2: 0}
	while n % 2 == 0:
		f[2] += 1
		n //= 2
	divisor = 3
	while divisor < sqroot and n != 1:
		while n % divisor == 0:
			if divisor in f:
				f[divisor] += 1
			else:
				f[divisor] = 1
			n //= divisor
		divisor += 2
	if n != 1:
		f[n] = 1
	return f

def count_even_divisors(n):
	f = factorization(n // 2)
	count = 1
	for k in f.keys():
		count *= f[k] + 1
	return count
for t in range(int(input())):
	n = int(input())
	if n % 2 != 0:
		print(0)
	else:
		print(count_even_divisors(n))


def make_prime_list():
	prime_list = []
	is_prime = [True for x in range(33335)]
	is_prime[0] = False
	is_prime[1] = False
	for i in range(33333):
		if is_prime[i]:
			for j in range(i, int(33335 / i)):
				is_prime[i * j] = False
			prime_list.append(i)
	return prime_list
prime_list = make_prime_list()

def num_divisors(n):
	powers = []
	for i in prime_list:
		if n <= 1:
			break
		if n % i == 0:
			powers.append(1)
			n /= i
			while n % i == 0:
				n /= i
				powers[-1] += 1
	if n != 1:
		powers.append(1)
	result = 1
	for power in powers:
		result *= power + 1
	return result
for _ in range(int(input())):
	n = int(input())
	if n % 2 != 0:
		print(0)
	else:
		print(num_divisors(n / 2))


from math import sqrt
for _ in range(int(input(''))):
	num = int(input(''))
	divisible = 0
	for i in range(1, int(sqrt(num)) + 1):
		if num % i == 0:
			if i % 2 == 0:
				divisible += 1
			k = int(num / i)
			if k % 2 == 0 and k != i:
				divisible += 1
	print(divisible)


import math
t = int(input())
while t > 0:
	t -= 1
	number = int(input())
	temp = number
	if number == 2:
		print(1)
		continue
	total = 1
	totalodd = 1
	i = 2
	while i * i <= temp:
		power = 0
		while number % i == 0:
			power += 1
			number //= i
		if i != 2:
			totalodd *= power + 1
		total *= power + 1
		i += 1
	if number > 2:
		total *= 2
		totalodd *= 2
	print(total - totalodd)


import functools, math, operator as op, sys

def is_prime(n):
	if n < 2:
		return False
	elif n == 2 or n == 3 or n == 5:
		return True
	elif n % 2 == 0 or n % 3 == 0 or n % 5 == 0:
		return False
	i = 6
	sqrt_n = int(math.ceil(math.sqrt(n)))
	while i <= sqrt_n + 1:
		if n % (i - 1) == 0 or n % (i + 1) == 0:
			return False
		i += 6
	return True

def prime_factors(n):
	factors = {}
	if n <= 1:
		return {}
	while n != 1:
		if is_prime(n):
			factors[n] = 1
			break
		i = 2
		while i <= n:
			j = 0
			while n % i == 0 and n != 1:
				j += 1
				n //= i
			if j > 0:
				factors[i] = j
				break
			i += 1
	return factors

def tau(n):
	return functools.reduce(op.mul, (v + 1 for v in prime_factors(n).values()), 1)
T = int(sys.stdin.readline())
for _ in range(T):
	N = int(sys.stdin.readline())
	print(tau(N // 2) if N % 2 == 0 else 0)


z = int(input())
for case in range(z):
	n = int(input())
	if n % 2:
		print(0)
	else:
		n /= 2
		ans = 1
		p = 2
		while p <= n:
			if p * p > n:
				p = n
			e = 0
			while n % p == 0:
				e += 1
				n /= p
			ans *= e + 1
			p += 1
		print(ans)


from math import sqrt

def divisors(n):
	for i in range(1, int(sqrt(n)) + 1):
		if n % i == 0:
			yield i
			j = n // i
			if j != i:
				yield j

def even_divisors_count(n):
	if n % 2 == 1:
		return 0
	count = 0
	while n % 2 == 0:
		count += 1
		n //= 2
	return count * len(list(divisors(n)))
T = int(input())
for i in range(T):
	N = int(input())
	print(even_divisors_count(N))


t = int(input())
for tests in range(t):
	n = int(input())
	cnt = 0
	i = 1
	while i * i <= n:
		if n % i == 0:
			m = int(n // i)
			if m == i and i % 2 == 0:
				cnt += 1
			else:
				if m % 2 == 0:
					cnt += 1
				if i % 2 == 0:
					cnt += 1
		i += 1
	print(cnt)


import functools, math, operator as op, sys

def is_prime(n):
	if n < 2:
		return False
	elif n == 2 or n == 3 or n == 5:
		return True
	elif n % 2 == 0 or n % 3 == 0 or n % 5 == 0:
		return False
	i = 6
	sqrt_n = int(math.ceil(math.sqrt(n)))
	while i <= sqrt_n + 1:
		if n % (i - 1) == 0 or n % (i + 1) == 0:
			return False
		i += 6
	return True

def prime_factors(n):
	factors = {}
	if n <= 1:
		return {}
	while n != 1:
		if is_prime(n):
			factors[n] = 1
			break
		i = 2
		while i <= n:
			j = 0
			while n % i == 0 and n != 1:
				j += 1
				n //= i
			if j > 0:
				factors[i] = j
				break
			i += 1
	return factors

def tau(n):
	return functools.reduce(op.mul, (v + 1 for v in prime_factors(n).values()), 1)
T = int(sys.stdin.readline())
for _ in range(T):
	N = int(sys.stdin.readline())
	print(tau(N // 2) if N % 2 == 0 else 0)


from functools import *

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
N = int(input())
for case in range(N):
	T = int(input())
	if T % 2 == 1:
		print(0)
	else:
		T = int(T / 2)
		count = 0
		factorlist = factors(T)
		for i in factorlist:
			if T % i == 0:
				count += 1
		print(count)


import math
primes = [2]

def prime_sieve(n):
	grimes = primes
	numbers = range(primes[-1], n + 1)
	while primes[-1] < n:
		numbers = [x for x in numbers if x % primes[-1] != 0]
		if len(numbers) == 0:
			break
		primes.append(numbers[0])
	if n < primes[-1]:
		k = len(grimes)
		while k != -1:
			k //= 2
			if n < grimes[len(grimes) - k - 1]:
				grimes = grimes[:len(grimes) - k - 1]
			if k == 0:
				k = -1
		return grimes
	return primes

def factorize(n):
	powers = [0]
	for p in prime_sieve(int(math.sqrt(n)) + 1):
		while n % p == 0:
			n //= p
			powers[-1] += 1
		if powers[-1] != 0:
			powers.append(0)
	if n != 1:
		powers.append(1)
	return powers
for _ in range(int(input())):
	N = int(input())
	if N % 2 == 1:
		print(0)
	else:
		ans = 1
		for x in factorize(N // 2):
			ans *= x + 1
		print(ans)


import functools, math, operator as op, sys

def is_prime(n):
	if n < 2:
		return False
	elif n == 2 or n == 3 or n == 5:
		return True
	elif n % 2 == 0 or n % 3 == 0 or n % 5 == 0:
		return False
	i = 6
	sqrt_n = int(math.ceil(math.sqrt(n)))
	while i <= sqrt_n + 1:
		if n % (i - 1) == 0 or n % (i + 1) == 0:
			return False
		i += 6
	return True

def prime_factors(n):
	factors = {}
	if n <= 1:
		return {}
	while n != 1:
		if is_prime(n):
			factors[n] = 1
			break
		i = 2
		while i <= n:
			j = 0
			while n % i == 0 and n != 1:
				j += 1
				n //= i
			if j > 0:
				factors[i] = j
				break
			i += 1
	return factors

def tau(n):
	return functools.reduce(op.mul, (v + 1 for v in prime_factors(n).values()), 1)
T = int(sys.stdin.readline())
for _ in range(T):
	N = int(sys.stdin.readline())
	print(tau(N // 2) if N % 2 == 0 else 0)


from math import sqrt
for t in range(int(input())):
	n = int(input())
	ns = sqrt(n) + 1
	r = 0
	for i in range(1, int(ns)):
		if n % i == 0:
			if i % 2 == 0:
				r += 1
			if n // i != i and n // i % 2 == 0:
				r += 1
	print(r)


from itertools import chain, cycle, accumulate

def factors(n):

	def prime_powers(n):
		for c in accumulate(chain([2, 1, 2], cycle([2, 4]))):
			if c * c > n:
				break
			if n % c:
				continue
			(d, p) = ((), c)
			while not n % c:
				(n, p, d) = (n // c, p * c, d + (p,))
			yield d
		if n > 1:
			yield (n,)
	r = [1]
	for e in prime_powers(n):
		r += [a * b for a in r for b in e]
	return r
for i in range(int(input())):
	n = int(input())
	a = factors(n)
	count = 0
	for h in a:
		if h % 2 == 0:
			count += 1
	print(count)


import math
for _ in range(int(input())):
	n = int(input())
	i = 1
	l = set()
	count = 0
	while i <= math.ceil(math.sqrt(n)):
		if n % i == 0:
			l.add(i)
			l.add(int(n / i))
		i += 1
	for x in l:
		if x % 2 == 0:
			count += 1
	print(count)


t = int(input())
from collections import defaultdict
for i in range(t):
	n = int(input())
	d = defaultdict(int)
	d[2] = 0
	while n % 2 == 0:
		n /= 2
		d[2] += 1
	if d[2] == 0:
		print(0)
		continue
	i = 3
	while i ** 2 <= n:
		if n % i == 0:
			d[i] += 1
			n = n // i
		else:
			i += 2
	if n != 1:
		d[n] += 1
	d[2] -= 1
	r = 1
	for e in d.values():
		r *= e + 1
	print(r)


import math
for i in range(int(input())):
	n = int(input())
	div = 0
	j = 1
	while j * j <= n:
		if n % j == 0:
			if j & 1 == 0:
				div += 1
			if j * j != n and n / j % 2 == 0:
				div += 1
		j += 1
	print(div)


t = int(input())
for _ in range(t):
	n = int(input())
	res = 0
	i = 1
	while i * i < n:
		if n % i == 0:
			if i % 2 == 0:
				res += 1
			if n // i % 2 == 0:
				res += 1
		i += 1
	if i * i == n and i % 2 == 0:
		res += 1
	print(res)


import math
ans = []
for x in range(0, int(input())):
	num = int(input())
	if num % 2 != 0:
		ans.append(0)
	else:
		cnt = 0
		for x in range(1, int(math.sqrt(num)) + 1):
			if num % x == 0 and num / x % 2 == 0 and (x % 2 == 0) and (num / x != x):
				cnt += 2
			elif num / x % 2 == 0:
				cnt += 1
			elif num % x == 0:
				cnt += 1
		ans.append(cnt)
for itm in ans:
	print(itm)


from fileinput import input
import math

def find():
	lines = input()
	noc = [int(x) for x in lines[0].strip().split()][0]
	for i in range(1, noc + 1):
		n = [int(x) for x in lines[i].strip().split()][0]
		val = helper(n, 2)
		if val == 0:
			print(val, end='\n')
			continue
		newn = n // int(math.pow(2, val))
		other = 0
		sq = int(math.sqrt(newn))
		for i in range(1, sq + 2, 2):
			if newn % i == 0:
				other += 1
				if i != newn // i:
					other += 1
		print(val * other)

def helper(n, m):
	div = m
	if n % div != 0:
		return 0
	num = 1
	while n % div == 0:
		tmp = div
		div = tmp * tmp
		num *= 2
	return num // 2 + helper(n // tmp, m)
find()


t = int(input())
for i in range(t):
	n = int(input())
	count = 0
	for j in range(1, int(pow(n, 0.5)) + 1):
		if n % j == 0:
			if j % 2 == 0 and n // j % 2 == 0:
				count += 2
			elif j % 2 == 0:
				count += 1
			elif n // j % 2 == 0:
				count += 1
	if int(pow(n, 0.5)) - pow(n, 0.5) == 0 and n % 2 == 0:
		count -= 1
	print(count)


import math
T = int(input().strip())
for t in range(T):
	n = int(input().strip())
	cnt = 0
	sq = int(math.sqrt(n))
	for i in range(1, sq + 1):
		if n % i == 0:
			if i % 2 == 0:
				cnt += 1
			divi = n // i
			if divi != i and divi % 2 == 0:
				cnt += 1
	print(cnt)


import math

def divisors(n):
	if n % 2 != 0:
		print(0)
	else:
		print((int(n ** 0.5) ** 2 == n) + sum(((i % 2 == 0) + (n // i % 2 == 0) for i in range(1, math.ceil(n ** 0.5)) if n % i == 0)))
t = int(input())
while t:
	n = int(input())
	divisors(n)
	t -= 1


from math import sqrt
from functools import reduce

def prime_factor(p):
	n = p
	a = {}
	if n % 2 == 0:
		a[2] = 0
		while n % 2 == 0:
			a[2] = a[2] + 1
			n = n // 2
		i = 3
		while i <= int(sqrt(n)):
			if n % i == 0:
				a[i] = 0
			while n % i == 0:
				a[i] = a[i] + 1
				n = n // i
			i = i + 2
			if i > int(sqrt(n)):
				break
		if n > 1:
			a[n] = 1
	return a
t = int(input())
for i in range(t):
	a = int(input())
	d = prime_factor(a)
	k = list(map(lambda x: x + 1, d.values()))
	if len(k) == 0:
		x = 0
		print(0)
	else:
		x = reduce(lambda x, y: x * y, k)
		print(x - x // (d[2] + 1))


import math

def divisors(n):
	res = 0
	for k in range(1, int(math.sqrt(n)) + 1):
		if not n % k:
			if k % 2 == 0:
				res += 1
			if n // k != k and n // k % 2 == 0:
				res += 1
	return res

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		print(divisors(n))
main()


def divisor_list(n):
	my_list = []
	for i in range(2, int(n ** (1 / 2)) + 1):
		if i == int(n ** (1 / 2)) and i ** 2 == n:
			my_list.append(i)
		elif n % i == 0:
			res = n / i
			my_list.append(res)
			my_list.append(i)
	my_list.append(n)
	return my_list
n = int(input())
for i in range(n):
	counter = 0
	current_number = int(input())
	my_list = divisor_list(current_number)
	for j in range(len(my_list)):
		if my_list[j] % 2 == 0:
			counter += 1
	print(counter)


from math import sqrt, ceil

def dvididers(N):
	d = set()
	for x in range(1, ceil(sqrt(N)) + 1):
		if N % x == 0:
			d.add(x)
			d.add(N // x)
	return len(d)
T = int(input())
for x in range(T):
	N = int(input())
	if N % 2 != 0:
		print(0)
	else:
		print(dvididers(N // 2))


for i in range(int(input())):
	N = int(input())
	temp = N
	N = N ** 0.5
	c = 2
	currentI = 0
	p = [0]
	while temp > 1 and c < 100000:
		if temp % c == 0:
			p[currentI] += 1
			temp = temp / c
		else:
			p.append(0)
			currentI += 1
			c += 1
	if temp > 1:
		p.append(1)
	total = 1
	for i in p:
		total *= i + 1
	print(total - int(total / (p[0] + 1)))


T = int(input())
N = []
for i in range(T):
	N.append(int(input()))
for n in N:
	x = 1
	y = n
	z = 0
	while x < y:
		if n % x == 0:
			if x % 2 == 0:
				z += 1
			if n / x != x and n / x % 2 == 0:
				z += 1
		y = n // x
		x += 1
	print(z)


from math import ceil, sqrt

def factor_int(n):
	dct = {}
	d = 2
	while d * d <= n:
		while n % d == 0:
			try:
				dct[d] += 1
			except:
				dct[d] = 1
			n //= d
		d += 1
	if n > 1:
		dct[n] = 1
	return dct
for _ in range(int(input())):
	n = int(input())
	if n % 2 == 1:
		print(0)
	else:
		dct = factor_int(n // 2)
		erg = 1
		for fac in list(dct.values()):
			erg *= fac + 1
		print(erg)


def divisors(n):
	i = 1
	while i ** 2 <= n:
		if n % i == 0:
			yield i
			if i ** 2 != n:
				yield (n // i)
		i += 1

def count(n):
	total = 0
	for div in divisors(n):
		if div % 2 == 0:
			total += 1
	return total
tests = int(input())
while tests:
	tests -= 1
	n = int(input())
	print(count(n))


from math import sqrt

def even_divisors(n):
	if n % 2 != 0:
		return 0
	limit = sqrt(n)
	current = 1
	number_of_even_divisors = 0
	while current <= limit:
		if n % current == 0:
			if current % 2 == 0:
				number_of_even_divisors += 1
			other = n / current
			if other != current and other % 2 == 0:
				number_of_even_divisors += 1
		current += 1
	return number_of_even_divisors
for i in range(int(input())):
	n = int(input())
	print(even_divisors(n))


t = input()
t = int(t)
for i in range(t):
	x = input()
	x = int(x)
	deli2 = 0
	j = 1
	while j * j < x:
		if x % j == 0:
			if j % 2 == 0:
				deli2 += 1
			u = x // j
			if u % 2 == 0:
				deli2 += 1
		j = j + 1
	if j * j == x:
		if j % 2 == 0:
			deli2 += 1
	print(deli2)


import math as m
t = int(input())
for i in range(0, t):
	n = int(input())
	count = 0
	for i in range(1, int(m.sqrt(n)) + 1):
		if n % i == 0 and i % 2 == 0:
			count = count + 1
		if n / i % 2 == 0:
			count = count + 1
	if int(m.sqrt(n)) ** 2 == n and n % 2 == 0:
		count = count - 1
	print(count)


def factors(n):
	return set((x for tup in ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0) for x in tup))
T = int(input())
for t in range(0, T):
	n = int(input())
	if n % 2 == 0:
		print(len(factors(n / 2)))
	else:
		print(0)


from math import sqrt
from functools import reduce
t = int(input())

def factors(n):
	step = 2 if n % 2 else 1
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(sqrt(n)) + 1, step) if n % i == 0)))
for case in range(t):
	n = int(input())
	count = sum((1 for num in factors(n) if num % 2 == 0)) if n % 2 == 0 else 0
	print(count)


import math
n = int(input())

def ku(x):
	total = 0
	sq = math.sqrt(x)
	if x % 2 == 1:
		WQ = 0
	else:
		i = 1
		while i <= sq:
			if x % i == 0:
				if i % 2 == 0:
					total += 1
				if x / i != i and x / i % 2 == 0:
					total += 1
			i += 1
	print(total)
for i in range(n):
	m = int(input())
	ku(m)


k = int(input())
for j in range(0, k):
	n = int(input())
	g = 0
	if n % 2 != 0:
		print(0)
	else:
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				if i % 2 == 0:
					g = g + 1
				if i != n / i and n / i % 2 == 0:
					g = g + 1
		print(g)


import sys
from math import sqrt
T = int(sys.stdin.readline()[:-1])
for _ in range(T):
	n = int(sys.stdin.readline())
	if n % 2 != 0:
		print(0)
		continue
	cnt = 0
	n //= 2
	for i in range(1, 1 + int(sqrt(n))):
		(j, r) = divmod(n, i)
		if r:
			continue
		if j == i:
			cnt += 1
		else:
			cnt += 2
	print(cnt)


for _ in range(int(input())):
	N = int(input())
	print(sum([int(x % 2 == 0) + int(N / x != x and N / x % 2 == 0) for x in range(1, int(N ** 0.5) + 1) if N % x == 0]))


import math
t = int(input())
while t:
	num = int(input())
	counter = 0
	for i in range(2, num + 1):
		if i > num / i:
			break
		if num % i == 0:
			if i % 2 == 0:
				counter += 1
			div = num // i
			if num % div == 0 and div % 2 == 0 and (num // div != div):
				counter += 1
	if num % 2 == 0:
		counter += 1
	print(counter)
	t -= 1


import math, sys
T = int(sys.stdin.readline())
for _ in range(T):
	N = int(sys.stdin.readline())
	if N % 2 == 1:
		print(0)
	else:
		print((int(N ** 0.5) ** 2 == N) + sum(((i % 2 == 0) + (N // i % 2 == 0) for i in range(1, math.ceil(N ** 0.5)) if N % i == 0)))


from math import sqrt, ceil
for _ in range(int(input())):
	n = int(input())
	count = 0
	sr = sqrt(n)
	for factor in range(1, ceil(sr)):
		if n % factor == 0:
			if factor % 2 == 0:
				count += 1
			if n // factor % 2 == 0:
				count += 1
	if sr == int(sr) and n % 2 == 0:
		count += 1
	print(count)


from math import sqrt

def factorize(n):
	if n < -1:
		return [(-1, 1)] + factorize(-n)
	elif n == -1:
		return [(-1, 1)]
	elif n == 0:
		return [(0, 1)]
	elif n == 1:
		return [(1, 1)]
	else:

		def potential_primes():
			base_primes = (2, 3, 5)
			for base_prime in base_primes:
				yield base_prime
			base_primes = (7, 11, 13, 17, 19, 23, 29, 31)
			prime_group = 0
			while True:
				for base_prime in base_primes:
					yield (prime_group + base_prime)
				prime_group += 30
		factors = []
		sqrtn = sqrt(n)
		for divisor in potential_primes():
			if divisor > sqrtn:
				break
			power = 0
			while n % divisor == 0:
				n //= divisor
				power += 1
			if power > 0:
				factors.append((divisor, power))
				sqrtn = sqrt(n)
		if n > 1:
			factors.append((n, 1))
		return factors

def divisors_from_factors(factors):

	def unsorted_divisors_from_factors(factors):
		if not factors:
			return [1]
		else:
			(base, max_power) = factors[0]
			if base == -1:
				return unsorted_divisors_from_factors(factors[1:])
			elif base == 0:
				return []
			elif base == 1:
				return unsorted_divisors_from_factors(factors[1:])
			else:
				divisors = unsorted_divisors_from_factors(factors[1:])
				all_divisors = []
				for power in range(0, max_power + 1):
					all_divisors += map(lambda x: x * base ** power, divisors)
				return all_divisors
	all_divisors = unsorted_divisors_from_factors(factors)
	all_divisors.sort()
	return all_divisors
for _ in range(int(input())):
	N = int(input())
	if N % 2:
		print('0')
	elif N == 2:
		print('1')
	else:
		F = factorize(N)
		D = divisors_from_factors(F)
		print(sum((1 for d in D if not d % 2)))


import math

def factors(n):
	res = []
	sq = int(math.sqrt(n))
	nq = n
	for i in range(1, sq):
		if not n % i:
			res.append(i)
			res.append(n // i)
	if n % sq == 0:
		if sq * sq == nq:
			res.append(sq)
		else:
			res.append(sq)
			res.append(n // sq)
	return res
for i in range(int(input())):
	l = factors(int(input()))
	cnt = 0
	for i in l:
		if not i & 1:
			cnt += 1
	print(cnt)


testcs = int(input())
for i in range(0, testcs):
	num = int(input())
	res = 0
	if num % 2 != 0:
		print(res)
		continue
	for ind in range(2, int(num ** 0.5) + 2):
		if num % ind == 0:
			if ind % 2 == 0 and num / ind != ind + 1:
				res += 1
			if num / ind % 2 == 0 and num / ind != ind + 1:
				res += 1
	if int(num ** 0.5) == num ** 0.5 or num == 2:
		print(res)
	else:
		print(res + 1)


def evenFactors(N):
	set = {}
	a = N % 2
	if a == 1:
		return 0
	set[2] = True
	set[N] = True
	upto = int(N ** 0.5) + 1
	for i in range(2, upto):
		if N % i == 0:
			if i % 2 == 0:
				set[i] = True
			x = int(N / i)
			if x % 2 == 0:
				set[x] = True
	return len(set)

def main():
	t = int(input())
	for i in range(0, t):
		n = int(input())
		print(evenFactors(n))
main()


from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
for _ in range(int(input())):
	total = 0
	for i in factors(int(input())):
		if i % 2 == 0:
			total += 1
	print(total)


for _ in range(int(input())):
	n = int(input())
	two = 0
	while n & 1 == 0:
		two += 1
		n >>= 1
	if two == 0:
		print('0')
		continue
	count = two
	i = 3
	while i * i <= n:
		c = 1
		while n % i == 0:
			c += 1
			n /= i
		count *= c
		i += 2
	if n > 1:
		count *= 2
	print(count)


import sys
import math

def read_num():
	return int(sys.stdin.readline())

def get_factors(n):
	return set((x for tup in ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0) for x in tup))
n = read_num()
for i in range(0, n):
	num = read_num()
	factors = get_factors(num)
	if 2 not in factors:
		print(0)
		continue
	if num == 2:
		print(1)
		continue
	w = 0
	for i in factors:
		if i % 2 == 0:
			w += 1
	print(w)


import math
for t in range(int(input())):
	x = int(input())
	count = 0
	if x % 2 == 1:
		print(0)
	else:
		for i in range(1, int(math.sqrt(x) + 1)):
			if x % i == 0:
				if i % 2 == 0:
					count += 1
				if x / i % 2 == 0 and x / i != i:
					count += 1
		print(count)


import math
T = int(input())
for _ in range(T):
	N = int(input())
	Nsqrt = math.sqrt(N)
	twos = 0
	while N % 2 == 0:
		N //= 2
		twos += 1
	if twos == 0:
		print(0)
		continue
	count = 0
	counts = []
	x = 3
	while N > 1 and x < Nsqrt:
		if N % x == 0:
			N //= x
			count = 1
			while N % x == 0:
				N //= x
				count += 1
			counts.append(count)
		x += 2
	if N > 1:
		counts.append(1)
	x = 1
	for count in counts:
		x *= count + 1
	print(twos * x)


from functools import reduce
from operator import mul

def factor(x):
	if x < 2:
		return
	i = 2
	n = 0
	while not x % i:
		n += 1
		x //= i
	if n:
		yield (i, n)
	i += 1
	while i * i <= x:
		n = 0
		while not x % i:
			n += 1
			x //= i
		if n:
			yield (i, n)
		i += 2
	if x > 1:
		yield (x, 1)

def n_divisors(x):
	return reduce(mul, (1 + f[1] for f in factor(x)), 1)
n_tests = int(input())
for t in range(n_tests):
	n = int(input())
	print(0 if n & 1 else n_divisors(n // 2))


import math

def divisorGenerator(n):
	large_divisors = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i is 0:
			yield i
			if i is not n / i:
				large_divisors.insert(0, n / i)
	for divisor in large_divisors:
		yield divisor
t = int(input())
for each in range(t):
	n = int(input())
	l = list(set(map(int, divisorGenerator(n))))
	l.sort()
	s = 0
	for i in range(len(l)):
		if l[i] % 2 == 0:
			s += 1
	print(s)


def factors(n):
	return set((x for tup in ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0) for x in tup))
T = int(input())
while T:
	n = int(input())
	if n % 2 != 0:
		print('0')
	else:
		count = 0
		s = factors(n)
		for i in s:
			if i % 2 == 0:
				count += 1
		print(count)
	T -= 1


import math
tc = int(input())
for l1 in range(tc):
	num = int(input())
	ctr = 0
	if num % 2 == 0:
		for i in range(1, int(math.sqrt(num)) + 1):
			if num % i == 0:
				if i % 2 == 0:
					ctr += 1
				if num // i != i and num // i % 2 == 0:
					ctr += 1
	else:
		for i in range(1, math.ceil(math.sqrt(num))):
			if num % i == 0:
				if i % 2 == 0:
					ctr += 1
				if num // i != i and num // i % 2 == 0:
					ctr += 1
	print(ctr)


from collections import defaultdict
from math import sqrt
from math import floor

def possible_primes(n):
	for k in range(1, (n - 1) // 6 + 1):
		yield (6 * k - 1)
		yield (6 * k + 1)

def primes(n):
	_primes = []
	for k in possible_primes(n):
		is_prime = True
		limit = floor(sqrt(k))
		for p in _primes:
			if p > limit:
				break
			if k % p == 0:
				is_prime = False
				break
		if is_prime:
			_primes.append(k)
	return [2, 3] + _primes
all_primes = primes(floor(sqrt(1000000000.0)))

def even_divs(N):
	if N % 2 == 1:
		return 0
	divs = defaultdict(int)
	i = 0
	while N != 1:
		if i == len(all_primes):
			divs[N] += 1
			break
		if N % all_primes[i] == 0:
			divs[all_primes[i]] += 1
			N /= all_primes[i]
		else:
			i += 1
	num_divs = divs[2]
	for d in divs:
		if d != 2:
			num_divs *= divs[d] + 1
	return num_divs
T = int(input())
for _ in range(T):
	N = int(input())
	print(even_divs(N))


import math
for i in range(int(input())):
	n = int(input())
	a = []
	for i in range(1, int(math.sqrt(n)) + 1):
		if n % i == 0:
			a.append(i)
			if i * i != n:
				a.append(int(n / i))
	count = 0
	for i in range(len(a)):
		if a[i] % 2 == 0:
			count = count + 1
	print(count)


def divisors(n):
	d = 1
	div = set()
	while d <= n ** (1 / 2):
		if n % d == 0:
			div.add(int(n / d))
			div.add(d)
			if n % 2 == 0:
				d = d + 1
			else:
				d = d + 2
		else:
			d = d + 1
	return div

def even_div(n):
	count = 0
	for x in divisors(n):
		if x % 2 == 0:
			count = count + 1
	return count
t = int(input().strip())
for x in range(t):
	n = int(input().strip())
	print(even_div(n))


def numevendiv(N):
	c = 0
	d = 1
	while d * d <= N:
		(e, r) = divmod(N, d)
		if r == 0:
			if d % 2 == 0:
				c += 1
			if e != d and e % 2 == 0:
				c += 1
		d += 1
	return c
T = int(input())
for n in range(T):
	print(numevendiv(int(input())))


def factors(n):
	result = set()
	for i in range(1, int(n ** 0.5) + 1):
		(div, mod) = divmod(n, i)
		if mod == 0:
			result |= {i, div}
	return result

def divTwo(n):
	(m, k) = (0, factors(n))
	for i in k:
		if i % 2 == 0:
			m = m + 1
	return m
lines = int(input())
for i in range(lines):
	print(divTwo(int(input())))


t = int(input())
for x in range(t):
	n = int(input())
	if n % 2 == 1:
		print(0)
	else:
		factors = [n]
		ncopy = n
		x = 2
		while x <= ncopy:
			if n % x == 0:
				yn = n / x % 2 in factors
				if n / x % 2 == 0 and yn == False:
					factors.append(int(n / x))
				yn = x % 2 in factors
				if x % 2 == 0 and yn == False and (x != n / x):
					factors.append(x)
			ncopy = int(n / x - 1)
			x += 1
		factors = set(factors)
		db2 = len(factors)
		print(db2)


from math import sqrt
import sys
f = sys.stdin
T = int(f.readline())
for i in range(T):
	N = int(f.readline())
	num = 0
	nmax = int(sqrt(N)) + 1
	for i in range(2, nmax):
		if N % i == 0:
			if i % 2 == 0:
				num += 1
			if N / i % 2 == 0 and i ** 2 != N:
				num += 1
	if N % 2 == 0:
		num += 1
	print(num)


import math
cases = int(input())
N = []
for i in range(cases):
	N.append(float(input()))
for i in range(len(N)):
	tot = 0
	for j in range(1, math.floor(math.sqrt(N[i])) + 1):
		if N[i] % j == 0:
			if j % 2 == 0:
				tot = tot + 1
			if j != int(N[i] / j):
				if int(N[i] / j) % 2 == 0:
					tot = tot + 1
	print(tot)


from math import sqrt

def factor2(n):
	factors = set()
	for x in range(1, int(sqrt(n)) + 1):
		if n % x == 0 and x % 2 == 0:
			factors.add(x)
		if n % x == 0 and n // x % 2 == 0:
			factors.add(n // x)
	return len(factors)
for _ in range(int(input())):
	r = int(input())
	if r % 2 == 1:
		print(0)
	else:
		print(factor2(r))


import math
test_case = int(input().strip())
for t in range(test_case):
	number = int(input().strip())
	count = 0
	list_divisors = []
	if number % 2 == 0:
		for i in range(1, int(math.sqrt(number)) + 1):
			if number % i == 0:
				if i % 2 == 0:
					count += 1
				if i != number // i and number // i % 2 == 0:
					count += 1
	print(count)


from math import sqrt, factorial

def combinations(N, R):
	return factorial(N) // (factorial(N - R) * factorial(R))
T = int(input())
for i in range(T):
	x = int(input())
	if x % 2 == 1:
		print(0)
	else:
		c = 0
		for i in range(1, int(sqrt(x)) + 1):
			if x % i == 0:
				if i % 2 == 0:
					c += 1
				if x // i % 2 == 0:
					c += 1
				if i == x // i:
					c -= 1
		print(c)


import math
T = int(input())

def get_divisors_divisible_by_two(N):
	if N % 2 != 0:
		return 0
	counter = 0
	n = 1
	seq = math.sqrt(N)
	while n <= seq:
		if N % n == 0:
			if n % 2 == 0:
				counter += 1
			other = N / n
			if other != n and other % 2 == 0:
				counter += 1
		n += 1
	return counter
for t in range(0, T):
	N = int(input())
	divisors = get_divisors_divisible_by_two(N)
	print(divisors)


from collections import Counter

def prime_factorization(n):
	d = 2
	factors = []
	while n > 1:
		while n % d == 0:
			factors.append(d)
			n //= d
		d += 1
		if d ** 2 > n:
			if n != 1:
				factors.append(n)
			break
	return factors
t = int(input())
for _ in range(t):
	n = int(input())
	counter = Counter(prime_factorization(n))
	if counter[2] != 0:
		counter = sorted(list(counter.items()))
		divs = counter[0][1]
		for i in range(1, len(counter)):
			divs *= counter[i][1] + 1
	else:
		divs = 0
	print(divs)


def solve():
	N = int(input())
	x = pow(N, 0.5)
	x = int(x) + 1
	cnt = int(0)
	for i in range(2, x):
		if N % i == 0:
			y = N // i
			if i % 2 == 0:
				cnt += 1
			if y % 2 == 0:
				cnt += 1
	if N > 2:
		if N % 2 == 0:
			cnt += 1
	x = pow(N, 0.5)
	x = int(x)
	if x * x == N:
		if x % 2 == 0:
			cnt -= 1
	if N == 2:
		cnt = 1
	print(cnt)

def main():
	t = int(input())
	while t > 0:
		solve()
		t -= 1
main()


import functools
from collections import Counter

def _prime_sieve(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			yield i

def _get_prime_factors(n):
	prime_factors = []
	for p in _prime_sieve(n):
		if p * p > n:
			break
		while n % p == 0:
			prime_factors.append(p)
			n //= p
	if n > 1:
		prime_factors.append(n)
	return prime_factors

def get_number_of_even_divisors(k):
	if k % 2 != 0:
		return 0
	factor_count = Counter(_get_prime_factors(k))
	num_factors = 1
	for count in factor_count.values():
		num_factors *= count + 1
	return num_factors - num_factors // (factor_count[2] + 1)
n = int(input())
for _ in range(n):
	k = int(input())
	print(get_number_of_even_divisors(k))


import math

def num_even_divisors(n):
	if n % 2 == 1:
		return 0
	sqrt = int(math.sqrt(n))
	count = 0
	for i in range(1, sqrt + 1):
		if n % i == 0:
			if i % 2 == 0:
				if n / i % 2 == 0 and n / i != i:
					count += 1
				count += 1
			elif n / i % 2 == 0:
				count += 1
	return count
T = int(input())
for t_i in range(T):
	N = int(input())
	print(num_even_divisors(N))


from math import sqrt, floor
t = int(input().strip())
for i in range(t):
	n = int(input().strip())
	if n % 2 == 1:
		print('0')
	else:
		h1_divs = [j for j in range(1, floor(sqrt(n)) + 1) if n % j == 0]
		h2_divs = list(map(lambda x: int(n / x), h1_divs))
		h1_divs.extend(h2_divs)
		ndivs = len([d for d in h1_divs if d % 2 == 0])
		if floor(sqrt(n)) ** 2 == n:
			print(ndivs - 1)
		else:
			print(ndivs)


import itertools
flatten_iter = itertools.chain.from_iterable

def factors(n):
	return set(flatten_iter(((i, n // i) for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
n = int(input())
for i in range(n):
	a = int(input())
	print(len(list((x for x in factors(a) if x % 2 == 0))))


import sys
import math
line = 0
for text in sys.stdin:
	if line > 0:
		n = int(text)
		if n % 2 == 1:
			result = 0
		else:
			divisors = 0
			maxvalue = int(math.sqrt(n))
			for i in range(1, maxvalue + 1):
				if n % i == 0:
					div1 = n / i
					div2 = i
					if div1 % 2 == 0:
						divisors += 1
					if div2 % 2 == 0 and div1 != div2:
						divisors += 1
			result = divisors
		print(result)
	line += 1


from itertools import chain

def divisors(n):
	return sorted(chain.from_iterable(((_, n // _) if n // _ != _ else [_] for _ in range(1, int(n ** 0.5) + 1) if n % _ == 0)))
t = int(input().strip())
arr = [int(input().strip()) for _ in range(t)]
print('\n'.join((str(sum((1 for _ in divisors(a) if _ % 2 == 0))) for a in arr)))


def factors(n):
	return set((x for tup in ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0) for x in tup))
t = int(input())
for i in range(t):
	n = int(input())
	print(len({x for x in factors(n) if x % 2 == 0}))


import math
t = int(input())
for i in range(t):
	n = int(input())
	m = []
	x = 0
	while n % 2 == 0:
		x = x + 1
		n = n / 2
	m.append(x)
	for j in range(3, math.floor(math.sqrt(n)) + 3, 2):
		x = 0
		while n % j == 0:
			x = x + 1
			n = n / j
		m.append(x)
	if n > 2:
		m.append(1)
	y = m[0]
	for i in range(1, len(m)):
		y *= m[i] + 1
	print(y)


def check(x, d):
	return x % d == 0 and d % 2 == 0

def solve(x):
	(a, d) = (0, 1)
	while d * d < x:
		a += check(x, d) + check(x, x / d)
		d += 1
	if x == d * d:
		a += check(x, d)
	return a
t = int(input())
for _ in range(t):
	print(solve(int(input())))


def primes(n):
	primfac = {}
	d = 2
	while d * d <= n:
		while n % d == 0:
			if d not in primfac:
				primfac[d] = 1
			else:
				primfac[d] = primfac[d] + 1
			n //= d
		d += 1
	if n > 1:
		if n not in primfac:
			primfac[n] = 1
		else:
			primfac[n] = primfac[n] + 1
	return primfac

def numOfDivisors(n):
	prime_fac = primes(n)
	if 2 not in prime_fac:
		return 0
	x = prime_fac.pop(2)
	for v in prime_fac.values():
		x = x * (v + 1)
	return x
t = int(input())
for _ in range(t):
	n = int(input())
	print(numOfDivisors(n))


from math import sqrt
for i in range(int(input())):
	x = int(input())
	if x & 1:
		print(0)
	else:
		print(sum((1 - (i & 1) if i * i == x else 2 - (i & 1) - (x // i & 1) for i in range(1, int(sqrt(x)) + 1) if x % i == 0)))


import math
n = int(input())
for x in range(n):
	N = int(input())
	res = 0
	root_of_N = math.sqrt(N)
	max_div = math.floor(root_of_N)
	if N % 2 == 0:
		for y in range(1, max_div + 1):
			if N % y == 0:
				if y % 2 == 0:
					if N / y % 2 == 0 and N / y != y:
						res += 2
					else:
						res += 1
				else:
					res += 1
	print(str(res))


from math import sqrt

def factors(n):
	factorsList = []
	for i in range(1, int(sqrt(n)) + 1):
		if n % i == 0:
			factorsList.append(i)
			if i != n // i:
				factorsList.append(n // i)
	return factorsList
for _ in range(int(input())):
	print(len(list(filter(lambda x: x % 2 == 0, factors(int(input()))))))


import math, sys
T = int(sys.stdin.readline())
for _ in range(T):
	N = int(sys.stdin.readline())
	if N % 2 == 1:
		print(0)
	else:
		print((int(N ** 0.5) ** 2 == N) + sum(((i % 2 == 0) + (N // i % 2 == 0) for i in range(1, math.ceil(N ** 0.5)) if N % i == 0)))


import math
t = int(input())

def divisors(n):
	divisors = []
	large_divisors = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			divisors.append(i)
			if i * i != n:
				large_divisors.append(n / i)
	return divisors + large_divisors
for i in range(t):
	n = int(input())
	d = divisors(n)
	print(len([x for x in d if x % 2 == 0]))