Jett is tired after destroying the town and she wants to have a rest. She likes high places, that's why for having a rest she wants to get high and she decided to craft staircases.

A staircase is a squared figure that consists of square cells. Each staircase consists of an arbitrary number of stairs. If a staircase has $n$ stairs, then it is made of $n$ columns, the first column is $1$ cell high, the second column is $2$ cells high, $\ldots$, the $n$-th column if $n$ cells high. The lowest cells of all stairs must be in the same row.

A staircase with $n$ stairs is called nice, if it may be covered by $n$ disjoint squares made of cells. All squares should fully consist of cells of a staircase. This is how a nice covered staircase with $7$ stairs looks like: [Image] 

Find out the maximal number of different nice staircases, that can be built, using no more than $x$ cells, in total. No cell can be used more than once.


-----Input-----

The first line contains a single integer $t$ $(1 \le t \le 1000)$  — the number of test cases.

The description of each test case contains a single integer $x$ $(1 \le x \le 10^{18})$  — the number of cells for building staircases.


-----Output-----

For each test case output a single integer  — the number of different nice staircases, that can be built, using not more than $x$ cells, in total.


-----Example-----
Input
4
1
8
6
1000000000000000000

Output
1
2
1
30



-----Note-----

In the first test case, it is possible to build only one staircase, that consists of $1$ stair. It's nice. That's why the answer is $1$.

In the second test case, it is possible to build two different nice staircases: one consists of $1$ stair, and another consists of $3$ stairs. This will cost $7$ cells. In this case, there is one cell left, but it is not possible to use it for building any nice staircases, that have not been built yet. That's why the answer is $2$.

In the third test case, it is possible to build only one of two nice staircases: with $1$ stair or with $3$ stairs. In the first case, there will be $5$ cells left, that may be used only to build a staircase with $2$ stairs. This staircase is not nice, and Jett only builds nice staircases. That's why in this case the answer is $1$. If Jett builds a staircase with $3$ stairs, then there are no more cells left, so the answer is $1$ again.

Difficulty: EASY

Solutions:
for _ in range(int(input())):
	n = int(input())
	prefix = [0] * 64
	for i in range(0, 64):
		prefix[i] = 2 ** (i + 1) - 1
	arr = [0] * 64
	for i in range(0, 64):
		arr[i] = prefix[i] * (prefix[i] + 1) // 2
	count = 0
	i = 0
	while n >= 0:
		n -= arr[i]
		i += 1
		count += 1
	print(count - 1)


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


N = 35
dp = [0] * N
dp[1] = 1
cnt = 1
for i in range(2, N):
	cnt = 2 * cnt + 1
	dp[i] = cnt * (cnt + 1) // 2
	dp[i] += dp[i - 1]
for _ in range(int(input())):
	x = int(input())
	ans = 1
	pos = 1
	for i in range(1, N - 1):
		if x < dp[i + 1]:
			pos = i
			break
	print(pos)


for t in range(int(input())):
	n = int(input())
	(now, ans) = (int(1), int(0))
	while n > 0:
		n -= now * (now + 1) // 2
		if n >= 0:
			ans += 1
		now = 2 * now + 1
	print(ans)


def solve(x):
	count = 0
	val = 1
	power = 2
	while val <= x:
		count += 1
		x -= val
		val = val * 2 + power * power
		power = power * 2
	print(count)
t = int(input())
for _ in range(t):
	x = int(input())
	solve(x)


t = int(input())
for _ in range(t):
	n = int(input())
	count = 0
	prev = 0
	for i in range(0, 60):
		cr = 2 * prev + (1 << i) ** 2
		if cr > n:
			break
		count += 1
		n -= cr
		prev = cr
	print(count)


from bisect import bisect_right as br
t = int(input())
while t:
	t -= 1
	n = int(input())
	l = [1]
	for i in range(31):
		l.append(2 * l[-1] + 1)
	cr = [ele * (ele + 1) // 2 for ele in l]
	soc = []
	soc.append(1)
	for i in range(1, 31):
		soc.append(cr[i] + soc[-1])
	print(br(soc, n))


def cellcount(l):
	e = (l + l ** 2) // 2
	return e
n = int(input())
for i in range(0, n):
	a = int(input())
	j = 1
	o = 1
	k = 0
	while a > 0:
		a = a - cellcount(j)
		o = o * 2
		j = o + j
		k = k + 1
	if a < 0:
		k = k - 1
	print(k)


from sys import stdin
from math import ceil, gcd

def func(m):
	a = 2 ** (2 * m + 1)
	b = 2 ** m
	return (a + 2 - 3 * b) // 3
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	m = 1
	while func(m) <= n:
		m += 1
	print(m - 1)


t = int(input())
dp = [1]
while dp[-1] < 10 ** 18 + 1:
	dp.append(dp[-1] * 2 + 4 ** len(dp))
from itertools import accumulate
dp = list(accumulate(dp))
from bisect import bisect_left as bl, bisect_right as br
for i in range(t):
	a = int(input())
	print(br(dp, a))


def solve_case(n):
	k = 0
	pow = 1
	escalera = 1
	while escalera <= n:
		k += 1
		n -= escalera
		escalera = escalera * 2 + (pow + 1) * (pow + 1)
		pow = pow * 2 + 1
	return k

def main():
	cases = int(input())
	for _ in range(cases):
		num = int(input())
		print('{}'.format(solve_case(num)))
main()


import sys
import heapq
import copy
import math
import decimal
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def insr2():
	s = input()
	s = list(s[:len(s) - 1])
	s = [ord(s[i]) - ord('a') for i in range(len(s))]
	return s

def invr():
	return map(int, input().split())
ans = 0

def pr_list(a):
	print(*a, sep=' ')

def swap(a, b):
	temp = a
	a = b
	b = temp
	return [a, b]

def pri(a, b):
	s = '? ' + str(a) + ' ' + str(b)
	print(s)
	sys.stdout.flush()

def main():
	tests = inp()
	mod = 1000000007
	limit = 10 ** 18
	ans = 0
	stack = []
	hashm = {}
	arr = []
	heapq.heapify(arr)
	for test in range(tests):
		x = inp()
		arr = 1
		ans = 1
		power = 2
		x = x - 1
		while True:
			arr = 2 * arr + power * power
			power = power * 2
			if arr <= x:
				x = x - arr
				ans = ans + 1
			else:
				break
		print(ans)
main()


import math
test = int(input())
for i in range(test):
	x = int(input())
	mark = 0
	xx = 1
	while x > 0:
		a = xx * (xx + 1) // 2
		while False:
			break
		if x >= a:
			mark += 1
			xx = 2 * xx + 1
		x -= a
	while False:
		break
	print(mark)


import math, sys, bisect, heapq
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
int1 = lambda x: int(x) - 1
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))
ilelec = lambda : map(int1, input().split())
alelec = lambda : list(map(int1, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])
for _ in range(int(input())):
	n = int(input())
	count = 0
	a = 1
	l = 1
	while n > 0:
		n -= l * (l + 1) // 2
		if n >= 0:
			count += 1
			a *= 2
			l += a
	print(count)


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


def solve(x):
	ans = 0
	i = 1
	jam = 0
	while True:
		a = 2 ** i - 1
		if jam + a * (a + 1) // 2 <= x:
			jam += a * (a + 1) // 2
			ans += 1
			i += 1
		else:
			return ans
t = int(input())
for _ in range(t):
	print(solve(int(input())))


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


t = int(input())
for zzz in range(t):
	count = 0
	stairCount = 0
	maxi = int(input())
	i = 1
	while True:
		if count + i * (i + 1) // 2 <= maxi:
			count = count + i * (i + 1) // 2
			stairCount += 1
			i = 2 * i + 1
		else:
			break
	print(stairCount)


from math import inf, sqrt, floor, ceil
from collections import Counter, defaultdict, deque
from heapq import heappush as hpush, heappop as hpop, heapify as h
from operator import itemgetter
from itertools import product
from bisect import bisect_left, bisect_right
for _ in range(int(input())):
	x = int(input())
	ans = 0
	i = 1
	while 1:
		nice = 2 ** i - 1
		v = nice * (nice + 1) // 2
		if v <= x:
			ans += 1
			x -= v
			i += 1
		else:
			break
	print(ans)


import math
t = int(input())
for i in range(t):
	n = int(input())
	l = []
	for j in range(1, n + 1):
		x = 2 ** j - 1
		x = x * (x + 1) // 2
		l.append(x)
		if sum(l) > n:
			l.pop()
			break
	print(len(l))


cand = [1]
for i in range(100):
	cand.append(cand[-1] * 2 + 1)
	if cand[-1] > 10 ** 18:
		break
for i in range(int(input())):
	ans = 0
	x = int(input())
	for i in cand:
		j = i * (i + 1) // 2
		if x - j < 0:
			break
		else:
			x -= j
			ans += 1
	print(ans)


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
import sys
letters = ascii_letters[:26]
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	need = 1
	res = 0
	if n >= 1:
		n -= 1
		res += 1
	while True:
		need *= 2
		bf = (need + need) * (need + need - 1) // 2
		if n < bf:
			break
		res += 1
		n -= bf
	print(res)


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True
a = []
t = 1
for i in range(1, 32):
	a.append(t)
	t += t + 1
for _ in range(ii()):
	n = ii()
	ans = 0
	for i in range(31):
		n -= a[i] * (a[i] + 1) // 2
		ans += 1
		if n < a[i + 1] * (a[i + 1] + 1) // 2:
			break
	print(ans)


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		p = 1
		s = 0
		ans = 0
		while True:
			p *= 2
			s += (p - 1) * p // 2
			if s > n:
				break
			ans += 1
		print(ans)
main()


arr = [1, 7]
ele = [1, 3]
from bisect import *
total = 7
while 1:
	x = ele[-1] + 2 * (ele[-1] - ele[-2])
	elem = total + x * (x + 1) // 2
	if elem <= pow(10, 18):
		arr.append(elem)
		ele.append(x)
	else:
		break
	total = elem
a = int(input())
for i in range(a):
	n = int(input())
	r = bisect_left(arr, n)
	if r == 30:
		print(30)
		continue
	if arr[r] > n:
		print(r)
	else:
		print(r + 1)


t = int(input())
for i in range(t):
	x = int(input())
	x = 6 * x
	start = 1
	end = 70
	ans = None
	while start <= end:
		mid = (start + end) // 2
		y = 4 * (2 ** (2 * mid) - 1) - 6 * (2 ** mid - 1)
		if y == x:
			ans = mid
			break
		elif y > x:
			end = mid - 1
		else:
			ans = mid
			start = mid + 1
	print(ans)


def main():
	for _ in range(int(input())):
		x = int(input())
		stairs = 1
		n = 1
		count = 1
		sum = 1
		x -= 1
		while True:
			n += 1
			stairs = 2 ** n - 1
			sum = stairs * (stairs + 1) // 2
			if sum > x:
				break
			x -= sum
			count += 1
		print(count)
main()


N = 70
X = [(-1 + (1 << i + 1)) * (1 << i) for i in range(N)]

def solve(x):
	res = 0
	tmp = x
	for i in range(N):
		if tmp >= X[i]:
			tmp -= X[i]
			res += 1
	return res
t = int(input())
for i in range(t):
	x = int(input())
	print(solve(x))


t = int(input())
for _ in range(t):
	n = int(input())
	i = 1
	ans = 0
	while n:
		m = 2 ** i - 1
		if n - m * (m + 1) // 2 >= 0:
			ans += 1
			n -= m * (m + 1) // 2
		else:
			break
		i += 1
	print(ans)


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


t = int(input())
for _ in range(t):
	x = int(input())
	start = 0
	ts = 0
	ans = 0
	while True:
		start = start * 2 + 1
		ts += start * (start + 1) // 2
		if ts <= x:
			ans += 1
		else:
			break
	print(ans)


import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
from itertools import accumulate

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

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

def Lstr():
	return list(sys.stdin.readline().strip())

def Str():
	return sys.stdin.readline().strip()

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

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

def Hash():
	return dict()

def Mod():
	return 1000000007

def Ncr(n, r, p):
	return fact[n] * (ifact[r] * ifact[n - r] % p) % p

def Most_frequent(list):
	return max(set(list), key=list.count)

def Mat2x2(n):
	return [List() for _ in range(n)]

def Lcm(x, y):
	return x * y // gcd(x, y)

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

def btod(n):
	return int(n, 2)

def common(l1, l2):
	return set(l1).intersection(l2)

def solution():
	for i in range(Int()):
		n = Int()
		a = 1
		c = 0
		need = 0
		while need <= n:
			c += 1
			need += a * (a - 1) // 2
			a = a * 2
		else:
			c -= 1
		print(c - 1)
solution()


def solve(n):
	big = float('inf')
	small = float('-inf')
	used = 0
	i = 0
	while True:
		i += 1
		used = (2 ** i - 1) * 2 ** (i - 1)
		n -= used
		if n == 0:
			return i
		elif n < 0:
			return i - 1

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		ans = solve(n)
		print(ans)
main()


def sum_ab(a, b):
	return int((a + b) / 2 * (b - a + 1))
for _ in range(int(input())):
	schody = int(input())
	koszt = 1
	cos = 1
	pot = 2
	x = 0
	while schody >= koszt:
		schody -= koszt
		cos += pot
		pot *= 2
		koszt = sum_ab(1, cos)
		x += 1
	print(x)


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


import math
TC = int(input())
for __ in range(TC):
	x = int(input())

	def F(n):
		return (4 ** (n + 1) - 1) // (4 - 1) - (2 ** (n + 1) - 1)
	n = 0
	while F(n) <= 2 * x:
		n += 1
	print(n - 1)


import sys
import bisect

def fun(a, x):
	m = bisect.bisect_right(a, x)
	return m
t = int(input())
k = 1
sum = 0
a = []
while sum < 1e+18:
	k = k << 1
	sum += k * (k - 1) // 2
	a.append(sum)
for tc in range(t):
	x = int(input())
	print(fun(a, x))


def ans(x):
	n = 1
	m = 2 ** n - 1
	temp = m * (m + 1) // 2
	a = 0
	while x - temp >= 0:
		x -= temp
		a += 1
		n += 1
		m = 2 ** n - 1
		temp = m * (m + 1) // 2
	return a
m = int(input())
for i in range(m):
	x = int(input())
	print(ans(x))


for t in range(int(input())):
	n = int(input())
	(count, add) = (0, 0)
	while True:
		add += 4 ** count + (2 ** count - 1) * 2 ** count // 2
		if n >= add:
			n -= add
		else:
			break
		count += 1
	print(count)


t = int(input())

def solve():
	x = int(input())
	tmp = 1
	sol = 1
	x -= 1
	for i in range(1, 68):
		tmp = tmp * 2 + 1
		if tmp * (tmp + 1) // 2 > x:
			break
		x -= tmp * (tmp + 1) // 2
		sol += 1
	print(sol)
for tt in range(t):
	solve()


t = int(input())
list = [2 ** (a - 1) * (2 ** a - 1) for a in range(1, 32)]
s = 0
d = []
for i in range(31):
	s += list[i]
	d.append(s)
for _ in range(t):
	x = int(input())
	i = 0
	while x >= d[i]:
		i += 1
	print(i)


arr = [1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911, 1073741823, 2147483647, 4294967295, 8589934591, 17179869183, 34359738367, 68719476735, 137438953471, 274877906943, 549755813887, 1099511627775, 2199023255551, 4398046511103, 8796093022207, 17592186044415, 35184372088831, 70368744177663, 140737488355327, 281474976710655, 562949953421311, 1125899906842623, 2251799813685247, 4503599627370495, 9007199254740991, 18014398509481983, 36028797018963967, 72057594037927935, 144115188075855871, 288230376151711743, 576460752303423487]

def s(num):
	return (1 + num) * num // 2
for _ in range(int(input())):
	x = int(input())
	c = 0
	n = 1
	while x - s(n) >= 0:
		x -= s(n)
		c += 1
		n = n * 2 + 1
	print(c)


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


import sys
input = sys.stdin.readline
T = int(input())
for t in range(T):
	X = int(input())
	answer = 0
	pow2 = 1
	while True:
		r = 2 ** pow2 - 1
		needed = r * (r + 1) // 2
		if needed <= X:
			answer += 1
			X -= needed
		else:
			break
		pow2 += 1
	print(answer)


for _ in range(int(input())):
	p = int(input())

	def func(n):
		sum = 0
		for i in range(n):
			sum = sum + 2 ** i
		return sum

	def sum(n):
		a = 0
		for i in range(n + 1):
			a = a + func(i) * (func(i) + 1) // 2
		return a
	n = 1
	while sum(n) < p:
		n = n + 1
	if sum(n) > p:
		print(n - 1)
	else:
		print(n)


for _ in range(int(input())):
	n = int(input())
	t = 0
	i = 1
	d = 2
	while n > 0 and i < 10 ** 25:
		var = i * (i + 1) // 2
		if n >= var:
			n -= var
			t += 1
		if n < var:
			break
		i += d
		d *= 2
	print(t)


from bisect import bisect
t = int(input())
buf = []
INF = 10 ** 18
stair = [1]
pre = [1]
while pre[-1] <= INF:
	p = stair[-1] * 2 + 1
	s = p * (p + 1) // 2
	stair.append(p)
	pre.append(pre[-1] + s)
for _ in range(t):
	n = int(input())
	buf.append(bisect(pre, n))
print('\n'.join(map(str, buf)))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	p = 1
	temp = n
	count = 0
	sumi = 0
	while True:
		p = p * 2
		sumi = p * (p - 1) // 2
		temp -= sumi
		if temp < 0:
			print(count)
			break
		count += 1


from collections import defaultdict
from queue import deque
from math import log2

def arrinp():
	return [*map(int, input().split(' '))]

def mulinp():
	return map(int, input().split(' '))

def intinp():
	return int(input())

def fun(n):
	return (n * n + n) // 2

def solution():
	n = int(input())
	n += 1
	count = 0
	val = 2
	while n > 0:
		count += 1
		n -= fun(val - 1)
		val *= 2
	print(count - 1)
	return
testcases = 1
testcases = int(input())
for _ in range(testcases):
	solution()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	(left, right) = (1, 30)
	while left < right:
		mid = right - (right - left) // 2
		cur = (4 ** mid - 1) * 2 // 3 - 2 ** mid + 1
		if cur <= n:
			left = mid
		else:
			right = mid - 1
	print(left)


arr = [0 for i in range(100)]
arr[0] = 1
for i in range(1, len(arr)):
	arr[i] = arr[i - 1] * 2 + 1
height = [0 for i in range(100)]
height[0] = 1
for i in range(1, len(arr)):
	height[i] = arr[i] * (arr[i] + 1) // 2
for _ in range(int(input())):
	x = int(input())
	currs = 0
	count = 0
	for i in range(100):
		currs += height[i]
		if currs > x:
			print(count)
			break
		count += 1


def fun(n):
	return n * (n + 1) // 2
for _ in range(int(input())):
	x = int(input())
	count = 0
	i = 1
	while x >= fun(i):
		x = x - fun(i)
		i = i * 2 + 1
		count += 1
	print(count)


T = int(input())
for _ in range(T):
	x = int(input())
	cnt = 0
	c = 1
	while x > 0:
		x -= c * (c + 1) // 2
		if x >= 0:
			cnt += 1
			c = 2 * c + 1
	print(cnt)


for _ in range(int(input())):
	x = int(input())
	(i, curr) = (0, 0)
	while True:
		curr = 2 * curr + 1
		val = curr * (curr + 1) // 2
		if x >= val:
			x -= val
			i += 1
		else:
			break
	print(i)


t = int(input())
while t:
	n = int(input())
	ans = 0
	for x in range(1, 50):
		u = 2 ** x - 1
		s = u * (u + 1) // 2
		if n >= s:
			n -= s
			ans += 1
		else:
			break
	print(ans)
	t -= 1


import os
import sys
from io import BytesIO, IOBase
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 RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)

def toord(c):
	return ord(c) - ord('a')

def lcm(a, b):
	return a * b // lcm(a, b)
mod = 998244353
INF = float('inf')
from math import factorial, sqrt, ceil, floor, gcd
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def main():
	for _ in range(N()):
		x = N()
		base = 1
		tag = 1
		res = 0
		while x > 0:
			x -= base
			if x >= 0:
				res += 1
			base = base * 2 + (2 ** tag) ** 2
			tag += 1
		print(res)
main()


import bisect
import sys
input = sys.stdin.readline
store = [0] * 40
for i in range(40):
	po = 2 ** (i + 1) - 1
	store[i] = po * (po + 1) // 2
copy = [store[0]]
for i in range(1, 40):
	copy.append(copy[-1] + store[i])
t = int(input())
for ii in range(t):
	n = int(input())
	ind = bisect.bisect(copy, n)
	print(ind)


tests = int(input())
for test in range(tests):
	n = int(input())
	ans = 0
	s = 0
	for i in range(1, 31):
		d = 2 ** i - 1
		r = d * (d + 1) // 2
		if s + r <= n:
			ans += 1
			s += r
		else:
			break
	print(ans)


t = int(input())
for case in range(t):
	x = int(input())
	cells = 0
	i = 0
	j = 1
	while cells <= x:
		cells += j * (j + 1) // 2
		i += 1
		j = 2 * j + 1
	print(i - 1)


tests = int(input())
for testnum in range(tests):
	n = int(input())
	k = 1
	power = 1
	times = 0
	sum = 0
	while True:
		adder = k * (k + 1) // 2
		if sum + adder <= n:
			sum += adder
			k += pow(2, power)
			power += 1
			times += 1
		else:
			break
	print(times)


def nice_stairs(n):
	(k, s, t, l) = (0, 0, 0, 0)
	while n > s:
		t = 2 ** k + s
		s += t
		n -= s
		k += 2
		if n >= 0:
			l += 1
	return l
for _ in range(int(input())):
	n = int(input())
	print(nice_stairs(n))


fun = lambda x: x * (x + 1) // 2
cell_sum = [0]
for i in range(1, 32):
	no = (1 << i) - 1
	cell_sum.append(cell_sum[-1] + fun(no))
t = int(input())
for i in range(t):
	x = int(input())
	ans = -1
	for no in cell_sum:
		if no <= x:
			ans += 1
		else:
			break
	print(ans)


for i in range(int(input())):
	x = int(input())
	i = -1
	while x >= 0:
		i += 1
		k = 2 ** i - 1
		x -= k * (k + 1) // 2
	print(i - 1)


def get_s(x):
	return x * (x + 1) / 2

def my_ans(n):
	ans = 0
	h = 1
	while n >= get_s(h):
		ans += 1
		n -= get_s(h)
		h = (h + 1) * 2 - 1
	return ans

def his_ans(num):
	n = 0
	x = 0
	while n <= num:
		x = x + 1
		m = 2 ** x - 1
		n += m * (m + 1) // 2
	return x - 1
t = int(input())
for _ in range(t):
	n = int(input())
	print(his_ans(n))


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
arr = []
i = 2
maxn = int(1e+18)
while True:
	temp = i * (i - 1) // 2
	if temp > maxn:
		break
	arr.append(temp)
	i *= 2
for _ in range(int(data())):
	n = int(data())
	answer = 0
	for i in arr:
		if i > n:
			break
		answer += 1
		n -= i
	out(answer)


def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = mpos(sum_so_far, current_sum)
	return sum_so_far

def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum

def graph(n, m):
	adj = dict()
	for i in range(1, n + 1):
		adj.setdefault(i, 0)
	for i in range(m):
		(a, b) = map(int, input().split())
		adj[a] += 1
		adj[b] += 1
	return adj
import sys
import threading
from math import *
for _ in range(int(input())):
	n = int(input())
	li = [0]
	for i in range(32):
		li.append(li[-1] * 2 + 2 ** (2 * i))
	li = li[1:]
	pref_sum = pref(li)
	pref_sum = pref_sum[1:]
	ind = upper_bound(pref_sum, n)
	print(ind + 1)


for _ in range(int(input())):
	n = int(input())
	ans = 0
	a = 0
	for i in range(0, 31):
		i = 2 ** i
		a += i * i + i * (i - 1) // 2
		n = n - a
		ans += 1
		if n == 0:
			break
		elif n < 0:
			ans -= 1
			break
		elif n > 0:
			continue
	print(ans)


a = [1]
for i in range(2, 10000):
	b = 2 ** i - 1
	ans = b * (b + 1) // 2
	a.append(ans)
t = int(input())
for i in range(0, t):
	x = int(input())
	for i in range(0, len(a)):
		if x - a[i] < 0:
			print(i)
			break
		x -= a[i]


def fun(x):
	i = 1
	ct = 0
	while i < 32 and x > 0:
		x -= 2 ** (i - 1) * (2 ** i - 1)
		i += 1
		ct += 1
	return ct if x == 0 else ct - 1
for _ in range(int(input())):
	x = int(input())
	print(fun(x))


from sys import *
input = stdin.readline
for _ in range(int(input())):
	x = int(input())
	curr = 1
	val = 1
	cn = 0
	while x >= 0:
		cn += 1
		x -= val * (val + 1) // 2
		curr *= 2
		val += curr
	stdout.write(str(cn - 1) + '\n')


import sys
import math as m

def main():
	pass

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 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 sinp():
	return sys.stdin.readline().strip()

def iinp():
	return int(input())

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

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

def p(a):
	print(a)
for _ in range(iinp()):
	x = iinp()
	n = 1
	ans = 0
	while True:
		ind = 0
		b = n
		tot = 0
		while b != 1:
			tot = tot + b * b * 2 ** ind
			b = b // 2
			ind += 1
		tot = tot + 2 ** ind
		x = x - tot
		if x >= 0:
			ans += 1
			n = n * 2
		else:
			break
	print(ans)


t = int(input())
for _ in range(t):
	x = int(input()) - 1
	n = 1
	arr = [1]
	while True:
		n *= 2
		arr.append(n)
		s = sum(arr) * (sum(arr) + 1) // 2
		if x - s < 0:
			arr.remove(n)
			break
		x -= s
	print(len(arr))


for _ in range(int(input())):
	n = int(input())
	total = 0
	count = 0
	other = 1
	z = 1
	while total < n:
		total += other * (other + 1) // 2
		count += 1
		z = 2 ** count
		other += z
	if total > n:
		count -= 1
	print(count)


for _ in range(int(input())):
	n = int(input())
	f = lambda a: a * (a + 1) // 2
	p = 0
	val = 1
	while f(val * 2 - 1) <= n:
		val *= 2
		p += 1
		n -= f(val - 1)
	print(p)


def solve():
	x = int(input())
	s = 1
	p = 2
	ans = 0
	while x:
		total = s * (s + 1) // 2
		if total > x:
			break
		ans += 1
		x -= total
		s = (1 << p) - 1
		p += 1
	print(ans)
	return

def main():
	t = 1
	t = int(input())
	for _ in range(t):
		solve()
main()


import os
import heapq
import sys, threading
import math
import operator
from collections import defaultdict, deque
from io import BytesIO, IOBase
sys.setrecursionlimit(10 ** 5)

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def inpt():
	return [int(k) for k in input().split()]

def main():
	for i in range(int(input())):
		n = int(input())
		ct = 0
		val = 1
		ar = []
		for i in range(60):
			val *= 2
			ar.append(val - 1)
		sm = 0
		for i in range(len(ar)):
			val = ar[i] * (ar[i] + 1) // 2
			if val + sm > n:
				break
			ct += 1
			sm += val
		print(ct)
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()


import math
t = int(input())
for q in range(0, t):
	n = int(input())
	curr = 1
	i = 2
	sum = 0
	ans = 0
	while True:
		cal = curr * (curr + 1) // 2
		if sum + cal <= n:
			sum += cal
			curr += i
			i = i * 2
			ans += 1
		else:
			break
	print(ans)


l = [1]
for i in range(70):
	l.append(2 * l[-1] + 1)
l = [ll * (ll + 1) // 2 for ll in l]
lll = [l[0]]
for i in range(1, 70):
	lll.append(lll[-1] + l[i])
l = lll
for t in range(int(input())):
	n = int(input())
	for i in range(70):
		if l[i] > n:
			print(i)
			break


def f(n):
	if n == 1:
		return 1
	return 4 * f(n - 1) + 2 ** (n - 1)
T = int(input())
for _ in range(T):
	x = int(input())
	res = 0
	for i in range(1, 31):
		cuad = f(i)
		if cuad <= x:
			x -= cuad
			res += 1
		else:
			break
	print(res)


t = int(input())
for _ in range(t):
	x = int(input())
	su = 0
	i = 2
	cnt = 0
	while su <= x:
		su += (i - 1) * i // 2
		i = i * 2
		cnt += 1
	print(cnt - 1)


from sys import stdin, stdout
from itertools import accumulate
smn = [1]
for i in range(32):
	smn += [(smn[-1] + 1) * 2 - 1]
a = []
for v in smn:
	a += [v * (v + 1) // 2]
a = list(accumulate(a))
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	ans = 0
	for v in a:
		if v > n:
			break
		ans += 1
	print(ans)


lst = [1, 6, 28, 120, 496, 2016, 8128, 32640, 130816, 523776, 2096128, 8386560, 33550336, 134209536, 536854528, 2147450880, 8589869056, 34359607296, 137438691328, 549755289600, 2199022206976, 8796090925056, 35184367894528, 140737479966720, 562949936644096, 2251799780130816, 9007199187632128, 36028796884746240, 144115187807420416, 576460751766552576, 2305843008139952128]
t = int(input())
for i in range(t):
	tar = int(input())
	s = 0
	for j in range(len(lst)):
		s += lst[j]
		if s > tar:
			print(j)
			break


import sys
from math import sqrt, gcd, ceil, log, floor
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
input = sys.stdin.readline
read = lambda : list(map(int, input().strip().split()))
MOD = 998244353

def main():
	ans = ''
	arr = [1, 6, 28, 120, 496, 2016, 8128, 32640, 130816, 523776, 2096128, 8386560, 33550336, 134209536, 536854528, 2147450880, 8589869056, 34359607296, 137438691328, 549755289600, 2199022206976, 8796090925056, 35184367894528, 140737479966720, 562949936644096, 2251799780130816, 9007199187632128, 36028796884746240, 144115187807420416, 576460751766552576]
	for i in range(1, 30):
		arr[i] += arr[i - 1]
	for _ in range(int(input())):
		n = int(input())
		ind = bisect(arr, n)
		if ind < 30 and arr[ind] == n:
			ind -= 1
		ans += str(ind)
		ans += '\n'
	print(ans)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	total_count = 0
	total = 0
	_pow = 1
	while total < n:
		stairs = 2 ** _pow - 1
		total += stairs * (stairs + 1) // 2
		total_count += 1
		_pow += 1
	if total > n:
		total_count -= 1
	print(total_count)


t = int(input())
for _ in range(t):
	n = int(input())
	(prod, cnt, val) = (1, 0, 2)
	while prod <= n:
		n -= prod
		cnt += 1
		prod = 2 * prod + val * val
		val *= 2
	print(cnt)


from collections import defaultdict as dd
from sys import stdin, stdout
from bisect import bisect_left
from math import log, sqrt
a = [0] * 50
for i in range(1, 50):
	a[i] = a[i - 1] * 2 + 4 ** (i - 1)
a.pop(0)
for t in range(int(stdin.readline().strip())):
	n = int(stdin.readline().strip())
	s = 0
	c = 0
	for i in a:
		s += i
		if s <= n:
			c += 1
	print(c)


for t in range(int(input())):
	n = int(input())
	start_power = 1
	count = 0
	while n > 0:
		size = 2 ** start_power - 1
		no_stairs = int(size * (size + 1) / 2)
		n -= no_stairs
		count += 1
		start_power += 1
	if n < 0:
		count -= 1
	print(count)


ty = [1]
p = 2
while True:
	p = p * 2
	ty.append(p - 1)
	if p > 10 ** 18:
		break
t = int(input())
for j in range(0, t):
	x = int(input())
	s = 0
	c = 0
	for o in ty:
		s = s + o * (o + 1) // 2
		if s <= x:
			c = c + 1
		else:
			break
	print(c)


from math import *

def _in():
	return [int(x) for x in input().split(' ')]
arr = [1]
while arr[-1] <= 10 ** 18:
	arr.append(arr[-1] * 2 + 1)
tt = int(input())
for _ in range(tt):
	n = int(input())
	(i, curr) = (0, 0)
	while curr <= n:
		curr = curr + arr[i] * (arr[i] + 1) // 2
		i = i + 1
	print(i - 1)


import math
arr = [1, 6, 28, 120, 496, 2016, 8128, 32640, 130816, 523776, 2096128, 8386560, 33550336, 134209536, 536854528, 2147450880, 8589869056, 34359607296, 137438691328, 549755289600, 2199022206976, 8796090925056, 35184367894528, 140737479966720, 562949936644096, 2251799780130816, 9007199187632128, 36028796884746240, 144115187807420416, 576460751766552576, 2305843008139952128, 9223372034707292160, 36893488143124135936, 147573952581086478336, 590295810341525782528, 2361183241400462868480, 9444732965670570950656, 37778931862819722756096, 151115727451553768931328, 604462909806764831539200, 2417851639228158837784576, 9671406556914834374393856, 38685626227663735544086528, 154742504910663738269368320, 618970019642672545263517696, 2475880078570725365426159616, 9903520314282971830448816128, 39614081257132028059283619840, 158456325028528393712111190016, 633825300114114137798398181376, 2535301200456457677093499568128, 10141204801825832960173811957760, 40564819207303336344294875201536, 162259276829213354384378755547136, 649037107316853435551913531670528, 2596148429267413778236451145646080, 10384593717069655185003398620512256, 41538374868278620884128782557904896, 166153499473114483824745506383331328, 664613997892457935875442777836748800, 2658455991569831744654692615953842176, 10633823966279326980924613473029062656, 42535295865117307928310139910543638528, 170141183460469231722463931679029329920, 680564733841876926908302470789826871296, 2722258935367507707670103371306726588416, 10889035741470030830754200461521744560128, 43556142965880123323164375798676654653440, 174224571863520493292952651099885971439616, 696898287454081973172400900209902591410176, 2787593149816327892690784192460327776944128, 11150372599265311570765497953082745930383360, 44601490397061246283066714178813853366747136, 178405961588244985132276301448221152757415936, 713623846352979940529124095258816089610518528, 2854495385411919762116534159967127315603783680, 11417981541647679048466212197732235176738553856, 45671926166590716193864999906656392535601053696, 182687704666362864775460301858080473799697891328, 730750818665451459101841811895231702513378918400, 2923003274661805836407368456506746424682690379776, 11692013098647223345629476243878624927989110931456, 46768052394588893382517909811217778170473142550528, 187072209578355573530071648916277669598925967851520, 748288838313422294120286615007923792229770666704896, 2993155353253689176481146498717321396587216257417216, 11972621413014756705924586072240538041685132210864128, 47890485652059026823698344443704657077413063205847040, 191561942608236107294793378084303638130997321548169216, 766247770432944429179173512956184572166679423642238976, 3064991081731777716716694053062678327952097969468080128, 12259964326927110866866776214726593390379152427670568960, 49039857307708443467467104863858133718658130810278772736, 196159429230833773869868419465336055188915565440308084736, 784637716923335095479473677881151261384228346159618326528, 3138550867693340381917894711564219126794045553435245281280, 12554203470773361527671578846336104669690446551334525075456, 50216813883093446110686315385502875003790314880525188202496, 200867255532373784442745261542328412665218316872474928611328, 803469022129495137770981046169947475960987382190648066048000]
for _ in range(int(input())):
	x = int(input())
	am = 0
	for i in range(100):
		if x < arr[i]:
			break
		x -= arr[i]
		am += 1
	print(am)


for _ in range(int(input())):
	result = 0
	cells = 0
	x = int(input())
	for i in range(1, x + 1):
		stair = 2 ** i - 1
		cells += int(stair * (stair + 1) / 2)
		if cells <= x:
			result = i
		else:
			break
	print(result)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p), end=': ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve(case):
	n = int(inp())
	curr = 3
	sum = 1
	cnt = 1
	while sum + curr * (curr + 1) // 2 <= n:
		cnt += 1
		sum += curr * (curr + 1) // 2
		curr = 2 * curr + 1
	print(cnt)
testcase(int(inp()))


for _ in range(int(input())):
	n = int(input())
	a = 0
	while n > 0:
		a += 1
		n = n - (4 ** a - 2 ** a) // 2
	print(a - (n < 0) * 1)


t = int(input())

def solve():
	x = int(input())
	cur = 1
	res = 0
	while (cur + 1) // 2 * cur <= x:
		x -= (cur + 1) // 2 * cur
		cur = cur + cur + 1
		res += 1
	return res
for _ in range(t):
	print(solve())


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


t = int(input())
for i in range(t):
	x = int(input())
	num = 0
	total = 0
	ans = 0
	while True:
		t_total = num * 2 + (2 ** ans) ** 2
		if total + t_total > x:
			print(ans)
			break
		else:
			num = t_total
			total += t_total
			ans += 1


import sys
from functools import lru_cache

@lru_cache(maxsize=None)
def s(n):
	if n == 0:
		return 0
	return a(n) + s(n - 1)

@lru_cache(maxsize=None)
def a(n):
	return 2 ** (n - 1) * (2 ** n - 1)
t = int(input())
for _ in range(t):
	x = int(input())
	toto = next((i for i in range(1, 100000) if s(i) > x))
	print(toto - 1)


l = []
i = 1
while i < 10 ** 18 + 5:
	l.append(i * (i + 1) // 2)
	i = i * 2 + 1
t = int(input())
for you in range(t):
	n = int(input())
	count = 0
	sum = 0
	for i in range(len(l)):
		sum += l[i]
		if sum > n:
			break
	print(i)


for _ in range(int(input())):
	x = int(input())
	val = 0
	cnt = 0
	ptr = 1
	while x >= 0:
		val = ptr * (ptr + 1) // 2
		x -= val
		ptr = ptr * 2 + 1
		cnt += 1
	print(cnt - 1)


def one_to_n(n):
	result = 0
	for i in range(1, n + 1):
		result += i
	return result
for _ in range(int(input())):
	n = int(input())
	answer = 1
	n -= 1
	temp = 1
	index = 2
	while True:
		temp = temp * 2 + int(pow(index, 2))
		if n >= temp:
			n -= temp
			answer += 1
			index *= 2
		else:
			break
	print(answer)


for o in range(int(input())):
	n = int(input())
	i = 0
	p = 0
	c = -1
	while n > 0:
		p = 2 * p + 2 ** i * 2 ** i
		i = i + 1
		n = n - p
		c = c + 1
	if n == 0:
		c = c + 1
	print(c)


arr = []
for i in range(1, 32):
	arr.append(2 ** i - 1)
temp = []
for i in arr:
	temp.append(i * (i + 1) // 2)
res = [temp[0]]
for i in range(1, len(temp)):
	res.append(res[-1] + temp[i])
for _ in range(int(input())):
	n = int(input())
	if n <= 6:
		print(1)
	elif 7 <= n <= 34:
		print(2)
	elif 35 <= n <= 154:
		print(3)
	else:
		for i in range(len(res)):
			if n < res[i]:
				print(i)
				break


for query in range(int(input())):
	m = int(input())
	count = 1
	total = 0
	while m >= count * (count + 1) // 2:
		m -= count * (count + 1) // 2
		count = count * 2 + 1
		total += 1
	print(total)


ht = [1]
nCells = [1]
while nCells[-1] < 10 ** 18:
	ht.append(2 * ht[-1] + 1)
	nCells.append(nCells[-1] * 2 + (ht[-2] + 1) ** 2)
t = int(input())
for _ in range(t):
	x = int(input())
	ans = 0
	i = 0
	while x >= 0:
		x -= nCells[i]
		i += 1
		ans += 1
	ans -= 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	x = 0
	p = 0
	c = 0
	while n > 0:
		x = 2 * x + 2 ** p
		n -= x
		p += 2
		c += 1
	if n < 0:
		c -= 1
	print(c)


arr = [1]
po = 4
while arr[-1] < 10 ** 18:
	k = po - 1
	arr.append(k * (k + 1) // 2)
	po = po * 2
pre_sum = [0]
for i in range(len(arr)):
	pre_sum.append(arr[i] + pre_sum[-1])
import bisect
for _ in range(int(input())):
	n = int(input())
	print(bisect.bisect(pre_sum, n) - 1)


t = input()
for i in range(int(t)):
	x = input()
	ans = 1
	max = 1
	while max <= int(x):
		ans += 1
		max = max + 2 ** (2 * ans - 1) - 2 ** (ans - 1)
	ans -= 1
	print(f'{ans}')


for _ in range(int(input())):
	x = int(input())
	if x == 1:
		print(1)
		continue
	a = s = n = 1
	while s <= x:
		a += pow(2, n)
		s += a * (a + 1) // 2
		n += 1
	print(n - 1)


import bisect
import collections
import copy
import functools
import heapq
import itertools
import math
import random
import re
import sys
import time
import string
from typing import List
sys.setrecursionlimit(99999)

def solve():
	n = int(input())
	(t, ans) = (2, 0)
	while t * (t - 1) // 2 <= n:
		n -= t * (t - 1) // 2
		ans += 1
		t <<= 1
	return ans
t = int(input())
for _ in range(t):
	print(solve())


t = int(input())
niceNumbers = [1, 6]
prev = 6
powr = 4
while True:
	newNum = 2 * prev + powr * powr
	powr *= 2
	niceNumbers.append(newNum)
	prev = newNum
	if newNum > int(1e+18):
		break
for _ in range(t):
	n = int(input())
	cnt = 0
	used = 0
	for i in range(len(niceNumbers)):
		if used + niceNumbers[i] <= n:
			cnt += 1
			used += niceNumbers[i]
		else:
			break
	print(cnt)


from math import log2
t = int(input())
for _ in range(t):
	n = int(input())
	for k in range(2 + int(log2(n)), -1, -1):
		if 2 * ((4 ** k - 1) // 3) - (2 ** k - 1) <= n:
			print(k)
			break


for _ in range(int(input())):
	x = int(input())
	tmp = 1
	cells = 1
	i = 1
	while cells <= x:
		tmp += 2 ** i
		cells += tmp * (tmp + 1) // 2
		i += 1
	print(i - 1)


from sys import stdin, stdout
from collections import deque
import bisect
from heapq import heapify, heappop, heappush
R = lambda : stdin.readline().strip()
RL = lambda f=None: list(map(f, R().split(' '))) if f else list(R().split(' '))
output = lambda x: stdout.write(str(x) + '\n')
output_list = lambda x: output(' '.join(map(str, x)))
T = int(R())
for _ in range(T):
	x = int(input())
	ans = 1
	dp = [1]
	x -= 1
	while x > 0:
		dp.append(1 + 2 * dp[-1])
		x -= dp[-1] * (dp[-1] + 1) // 2
		if x >= 0:
			ans += 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = 0
	for i in range(1, n + 2):
		x = 2 ** i
		a += 2 ** (i - 1) * (2 ** i - 1)
		if a > n:
			print(i - 1)
			break


for _ in range(int(input())):
	n = int(input())
	count = 0
	i = 1
	stair = 1
	while n >= stair * i:
		n = n - i * stair
		count += 1
		i = i * 2
		stair += i
	print(count)


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

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)
l = []
for i in range(1, 33):
	n = 2 ** i
	n -= 1
	l.append(n * (n + 1) // 2)
for xyz in range(0, int(input())):
	n = int(input())
	s = 0
	i = 0
	a = 0
	while s + l[i] <= n:
		s += l[i]
		a += 1
		i += 1
	print(a)


t = int(input())

def f(n):
	s = 3
	cnt = 1
	al = 1
	while cnt + s * (s + 1) // 2 <= n:
		cnt += s * (s + 1) // 2
		s *= 2
		s += 1
		al += 1
	return al
for _ in range(t):
	print(f(int(input())))


T = int(input())
for _ in range(T):
	N = int(input())
	ans = 0
	i = 1
	while 1:
		a = i * (i + 1) // 2
		if N - a < 0:
			break
		N -= a
		ans += 1
		i = (i + 1) * 2 - 1
	print(ans)


def numCells(height):
	return height * (height + 1) // 2

def countStair(x):
	p = 0
	numStair = 0
	height = 2
	while p <= x:
		p += numCells(height - 1)
		height *= 2
		numStair += 1
	return numStair - 1
t = int(input())
for i in range(t):
	x = int(input())
	print(countStair(x))


def recursive(n):
	x1 = 1
	x2 = 1
	x3 = 1
	x4 = 1
	while x3 <= n:
		x2 = x2 * 2 + 1
		x1 = x2 * (x2 + 1) // 2
		x3 = x3 + x1
		x4 = x4 + 1
	x4 = x4 - 1
	return x4
a = int(input())
for i in range(a):
	b = int(input())
	print(recursive(b))


t = int(input())
a = [0, 1, 7, 35, 155, 651, 2667, 10795, 43435, 174251, 698027, 2794155, 11180715, 44731051, 178940587, 715795115, 2863245995, 11453115051, 45812722347, 183251413675, 733006703275, 2932028910251, 11728119835307, 46912487729835, 187649967696555, 750599904340651, 3002399684471467, 12009598872103595, 48038395756849835, 192153583564270251, 768614335330822827, 3074457343470774955, 12297829378178067115, 49191317521302203051, 196765270102388681387]
for w in range(t):
	x = int(input())
	pr = False
	for i in range(len(a)):
		if x < a[i]:
			print(i - 1)
			pr = True
			break


import sys
import math

def fn(n):
	k = 1
	sum = 1
	count = 0
	while sum <= n:
		count = count + 1
		k = k + 1
		sum = sum + (2 ** k - 1) * 2 ** (k - 1)
	return count
input = sys.stdin.read()
data = list(map(int, input.split()))
t = data[0]
for i in range(t):
	n = data[i + 1]
	print(fn(n))


def testcase():
	data = [1, 6, 28, 120, 496, 2016, 8128, 32640, 130816, 523776, 2096128, 8386560, 33550336, 134209536, 536854528, 2147450880, 8589869056, 34359607296, 137438691328, 549755289600, 2199022206976, 8796090925056, 35184367894528, 140737479966720, 562949936644096, 2251799780130816, 9007199187632128, 36028796884746240, 144115187807420416, 576460751766552576, 2305843008139952128]
	n = int(input())
	sum = data[0]
	for i in range(1, len(data)):
		if sum + data[i] > n:
			print(i)
			break
		sum += data[i]
	return
t = int(input())
for _ in range(t):
	testcase()


A = [1]
s = 1
for i in range(32):
	s *= 4
	A.append(A[-1] * 2 + s)
S = [0] * 33
for i in range(32):
	S[i + 1] = S[i] + A[i]
T = int(input())
for _ in range(T):
	N = int(input())
	for i in range(33):
		if S[i] > N:
			print(i - 1)
			break


n = int(input())
for i in range(n):
	num = int(input())
	output = 0
	size = 1
	toAdd = 1
	while size <= num:
		output += 1
		num -= size
		toAdd *= 2
		size *= 4
		size += toAdd
	print(output)


import sys
input = sys.stdin.buffer.readline
T = int(input())
for testcase in range(T):
	x = int(input())
	cnt = 0
	p = 1
	while x >= 0:
		x -= p * (p + 1) // 2
		if x >= 0:
			cnt += 1
		p = p * 2 + 1
	print(cnt)


for s in [*open(0)][1:]:
	x = int(s)
	i = -1
	while x >= 0:
		i += 1
		k = 2 ** i
		x -= 2 * k * k - k
	print(i)


import sys, math
try:
	(sys.stdin, sys.stdout) = (open('input.txt', 'r'), open('out.txt', 'w'))
except:
	pass
from sys import stdin, stdout
mod = int(1000000000.0 + 7)
from statistics import mode
from collections import *
from math import ceil, floor, inf, factorial, gcd, log2, sqrt, log
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()

def lcm(a, b):
	return a * b // gcd(a, b)

def setbits(n):
	return bin(n).count('1')

def resetbits(n):
	return bin(n).count('0')

def modinv(n, p):
	return pow(n, p - 2, p)

def ncr(n, r):
	(num, den) = (1, 1)
	r = min(n, n - r)
	for i in range(r):
		num *= n - i
		den *= i + 1
	return num // den

def ncr_p(n, r, p):
	(num, den) = (1, 1)
	r = min(r, n - r)
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * modinv(den, p) % p

def isPrime(num):
	if num <= 1:
		return False
	if num == 2 or n == 3:
		return True
	if num % 2 == 0 or num % 3 == 0:
		return False
	m = int(num ** 0.5) + 1
	for i in range(5, m, 6):
		if num % i == 0 or num % (i + 2) == 0:
			return False
	return True

def bin_search(s, low, high, val):
	while low <= high:
		mid = low + (high - low) // 2
		if s[mid] == val:
			return mid
		elif s[mid] < val:
			low = mid + 1
		else:
			high = mid - 1
	return -1

def sumofdigit(num):
	count = 0
	while num:
		count += num % 10
		num //= 10
	return count

def inputmatrix():
	(r, c) = iia()
	mat = [0] * r
	for i in range(r):
		mat[i] = iia()
	return (r, c, mat)

def prefix_sum(n, s):
	for i in range(1, n):
		s[i] += s[i - 1]
	return s

def binomial(n, k):
	if 0 <= k <= n:
		ntok = 1
		ktok = 1
		for t in range(1, min(k, n - k) + 1):
			ntok *= n
			ktok *= t
			n -= 1
		return ntok // ktok
	else:
		return 0

def divisors(n):
	res = []
	for i in range(1, ceil(sqrt(n)) + 1):
		if n % i == 0:
			if i == n // i:
				res.append(i)
			else:
				res.append(i)
				res.append(n // i)
	return res

def fun(n):
	val = 1
	ans = []
	while val < n:
		val <<= 1
		a = val - 1
		ans.append(a * (a + 1) // 2)
	val <<= 1
	a = val - 1
	ans.append(a * (a - 1) // 2)
	return ans
for _ in range(ii1()):
	n = ii1()
	arr = fun(n)
	ans = 0
	for i in arr:
		if n >= i:
			ans += 1
			n -= i
	print(ans)


from math import sqrt

def solve(n):
	return int((sqrt(1 + 8 * n) - 1) // 2)
for _ in range(int(input())):
	p = int(input())
	ans = 0
	c = 1
	while True:
		if p >= c * (c + 1) // 2:
			ans += 1
			p -= c * (c + 1) // 2
			c = 2 * c + 1
		else:
			break
	print(ans)


from sys import stdin

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

def get_str():
	return stdin.readline().strip()

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

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

def get_array2d(row):
	return [list(map(int, stdin.readline().strip().split())) for _ in range(row)]
T = get_int()
for _ in range(T):
	X = get_int()
	(noOfCell, d, ans) = (8, 2, 1)
	count = noOfCell - d + 1
	while count <= X:
		noOfCell <<= 2
		d <<= 1
		count += noOfCell - d
		ans += 1
	print(ans)


t = int(input())
x = []
for i in range(t):
	x.append(int(input()))
for i in x:
	temp = i
	acum = 0
	altura = 0
	count = 0
	termine = True
	while termine:
		acum = 2 * acum + (altura + 1) ** 2
		altura += altura + 1
		temp = temp - acum
		if temp >= 0:
			count += 1
		else:
			termine = False
	print(count)


import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
import threading
from collections import defaultdict
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
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')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default=2 ** 30, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] < key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] > k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater

class TrieNode:

	def __init__(self):
		self.children = [None] * 26
		self.isEndOfWord = False

class Trie:

	def __init__(self):
		self.root = self.getNode()

	def getNode(self):
		return TrieNode()

	def _charToIndex(self, ch):
		return ord(ch) - ord('a')

	def insert(self, key):
		pCrawl = self.root
		length = len(key)
		for level in range(length):
			index = self._charToIndex(key[level])
			if not pCrawl.children[index]:
				pCrawl.children[index] = self.getNode()
			pCrawl = pCrawl.children[index]
		pCrawl.isEndOfWord = True

	def search(self, key):
		pCrawl = self.root
		length = len(key)
		for level in range(length):
			index = self._charToIndex(key[level])
			if not pCrawl.children[index]:
				return False
			pCrawl = pCrawl.children[index]
		return pCrawl != None and pCrawl.isEndOfWord

class Node:

	def __init__(self, data):
		self.data = data
		self.count = 0
		self.left = None
		self.right = None

class BinaryTrie:

	def __init__(self):
		self.root = Node(0)

	def insert(self, pre_xor):
		self.temp = self.root
		for i in range(31, -1, -1):
			val = pre_xor & 1 << i
			if val:
				if not self.temp.right:
					self.temp.right = Node(0)
				self.temp = self.temp.right
				self.temp.count += 1
			if not val:
				if not self.temp.left:
					self.temp.left = Node(0)
				self.temp = self.temp.left
				self.temp.count += 1
		self.temp.data = pre_xor

	def query(self, xor):
		self.temp = self.root
		for i in range(31, -1, -1):
			val = xor & 1 << i
			if not val:
				if self.temp.left and self.temp.left.count > 0:
					self.temp = self.temp.left
				elif self.temp.right:
					self.temp = self.temp.right
			elif self.temp.right and self.temp.right.count > 0:
				self.temp = self.temp.right
			elif self.temp.left:
				self.temp = self.temp.left
			self.temp.count -= 1
		return xor ^ self.temp.data
for ik in range(int(input())):
	n = int(input())
	t = 2
	ans = 0
	while n >= 0:
		if n >= t * (t - 1) // 2:
			n -= t * (t - 1) // 2
			t *= 2
			ans += 1
		else:
			break
	print(ans)


import math
import os
import random
import re
import sys
for _ in range(int(input())):
	x = int(input())
	sum = 0
	cnt = 0
	for i in range(1, 1000000000):
		i1 = pow(2, i - 1)
		i2 = pow(2, i) - 1
		sum += i1 * i2
		if sum > x:
			break
		cnt += 1
	print(cnt)


a = [1, 6, 28, 120, 496, 2016, 8128, 32640, 130816, 523776, 2096128, 8386560, 33550336, 134209536, 536854528, 2147450880, 8589869056, 34359607296, 137438691328, 549755289600, 2199022206976, 8796090925056, 35184367894528, 140737479966720, 562949936644096, 2251799780130816, 9007199187632128, 36028796884746240, 144115187807420416, 576460751766552576, 576460751766552576 * 2]
t = int(input())
for _ in range(t):
	x = int(input())
	ans = 0
	i = 0
	while x >= 0:
		if x >= a[i]:
			x -= a[i]
			i += 1
			ans += 1
		else:
			break
	print(ans)


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

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

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
mod = int(1000000000.0) + 7

def sumOfAP(n):
	sum = n / 2 * (2 + (n - 1))
	return int(sum)
t = [sumOfAP(pow(2, i) - 1) for i in range(1, 61)]
for _ in range(iinput()):
	x = iinput()
	ans = 0
	cnt = 0
	while ans <= x:
		ans += t[cnt]
		cnt += 1
	print(cnt - 1)


n = 0
s = 0
numbers = [0] * 32
while n < 31:
	n += 1
	s += (2 ** n - 1) * 2 ** (n - 1)
	numbers[n] = s
t = int(input())
for i in range(t):
	x = int(input())
	left = 0
	right = 31
	while right - left > 1:
		middle = (left + right) // 2
		if x >= numbers[middle]:
			left = middle
		else:
			right = middle
	print(left)


for _ in range(int(input())):
	x = int(input())
	val = 1
	count = 0
	nxt = 2
	s = 1
	while s <= x:
		val = 2 * val + nxt * nxt
		s += val
		nxt *= 2
		count += 1
	print(count)


import sys
read = lambda : sys.stdin.readline().strip()
readi = lambda : map(int, read().split())
from math import sqrt, log2
for _ in range(int(read())):
	x = int(read())
	i = 1
	ans = 0
	while True:
		x -= i * (i + 1) // 2
		if x < 0:
			break
		ans += 1
		i = 2 * i + 1
	print(ans)


def modinv(n, p):
	return pow(n, p - 2, p)

def main():
	y = 1
	series = []
	k = 2
	while y <= int(1e+18):
		series.append(y)
		y = 2 * y + k ** 2
		k *= 2
	for case in range(int(input())):
		c = 0
		x = int(input())
		s = 0
		for i in range(len(series)):
			s += series[i]
			if s <= x:
				c += 1
			else:
				break
		print(c)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			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()


for i in range(int(input())):
	a = int(input())
	b = 1
	c = 0
	while a > 0:
		a -= (2 ** b - 1) * 2 ** (b - 1)
		b += 1
		if a == 0:
			c = b - 1
		elif a < 0:
			c = b - 2
	print(c)


A = [1, 2, 4, 8]
for i in range(30):
	A += [A[-1] * 2]
A = [i - 1 for i in A]
B = [i * (i + 1) // 2 for i in A]
for i in range(1, len(B)):
	B[i] = B[i] + B[i - 1]
for _ in range(int(input())):
	X = int(input())
	printed = False
	for i in range(len(B)):
		if X == B[i]:
			print(i)
			printed = True
			break
		elif X < B[i]:
			print(i - 1)
			printed = True
			break


def nsum(n):
	return n * (n + 1) // 2
for _ in range(int(input().strip())):
	x = int(input().strip())
	i = 1
	p = nsum(2 ** i - 1)
	ans = 0
	while p <= x:
		ans += 1
		x -= p
		i += 1
		p = nsum(2 ** i - 1)
	print(ans)


import sys, math, heapq, copy
from collections import defaultdict, deque
from bisect import bisect_left, bisect_right
from functools import cmp_to_key
from itertools import permutations, combinations, combinations_with_replacement
mod = 1000000007

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

def get_str():
	return sys.stdin.readline().strip()

def get_float():
	return float(sys.stdin.readline().strip())

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

def get_strs():
	return map(str, sys.stdin.readline().strip().split())

def get_floats():
	return map(float, sys.stdin.readline().strip().split())

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

def list_strs():
	return list(map(str, sys.stdin.readline().strip().split()))

def list_floats():
	return list(map(float, sys.stdin.readline().strip().split()))
t = get_int()
for _ in range(t):
	n = get_int()
	ans = 0
	xpower = stairs = 0
	while True:
		stairs += pow(2, xpower)
		cells = stairs * (stairs + 1) // 2
		if cells <= n:
			n -= cells
			ans += 1
		else:
			break
		xpower += 1
	print(ans)


t = int(input())
for tc in range(t):
	x = int(input())
	count = 0
	while x >= 0:
		x -= 2 * (2 ** count) ** 2 - 2 ** count
		count += 1
	print(count - 1)


import collections

def solution(n):
	c = 1
	while True:
		s = 2 ** c - 1
		n -= s * (s + 1) // 2
		if n < 0:
			break
		c += 1
	return c - 1
t = int(input())
for _ in range(t):
	n = int(input())
	print(solution(n))


import os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for _ in range(int(input())):
	x = int(input())
	total = 1
	cnt = 1
	square = 1
	number = 0
	while x >= 0:
		if x >= cnt:
			x -= cnt
			number += 1
			square *= 4
			cnt = cnt * 2 + square
		else:
			break
	print(number)


b = []
k = 2
for i in range(30):
	b.append((k - 1) * k // 2)
	k *= 2
for _ in range(int(input())):
	n = int(input())
	ss = 0
	for i in b:
		if n >= i:
			n -= i
			ss += 1
	print(ss)


gans = []
for _ in range(int(input())):
	n = int(input())
	ans = 0
	cur = 1
	while n >= cur * (cur + 1) // 2:
		n -= cur * (cur + 1) // 2
		ans += 1
		cur = cur * 2 + 1
	gans.append(ans)
print('\n'.join(map(str, gans)))


def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	x = inp()
	res = 0
	size = 1
	stairs = 1
	while x >= 0:
		x -= size
		res += 1
		stairs += stairs + 1
		size = stairs * (stairs + 1) // 2
	print(res - 1)


def x():
	N = int(input())
	for i in range(N):
		A = int(input())
		ans = 1
		count = 0
		B = 1
		while A >= ans:
			A = A - ans
			ans = ans * 2 + B * 2 * (B * 2)
			count += 1
			B = B * 2
		print(count)
x()


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


dp = []
dp.append((1, 1))
for i in range(1, 31):
	dp.append((2 * dp[i - 1][0] + 1, 2 * dp[i - 1][1] + (dp[i - 1][0] + 1) ** 2))
t = int(input())
for i in range(t):
	tmp = 0
	x = int(input())
	ind = 0
	while ind < len(dp) and tmp < x:
		tmp += dp[ind][1]
		ind += 1
	if tmp > x:
		ind -= 1
	print(ind)


t = int(input())
for w in range(t):
	x = int(input())
	y = 0
	t = 0
	i = 1
	c = 1
	while y + i * (i + 1) // 2 <= x:
		y += i * (i + 1) // 2
		i += 2 ** c
		c += 1
		t += 1
	print(t)


l = [1]
j = 0
i = 2
while l[-1] <= 1e+18:
	l.append(l[j] * 2 + 2 ** i)
	j += 1
	i += 2

def solve(n):
	cnt = 0
	for k in l:
		if k <= n:
			n -= k
			cnt += 1
	return cnt
for _ in range(int(input())):
	n = int(input())
	print(solve(n))


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac
from itertools import permutations as permu

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
num = 1
num = int(z())
for _ in range(num):
	n = int(z())
	s = 0
	i = 2
	cnt = 0
	while s <= n:
		s += (i - 1) * i // 2
		i *= 2
		cnt += 1
	print(cnt - 1)


import math
d = []
k = 1
while k <= 2000000000.0:
	d.append(k * (k + 1) // 2 + (d[-1] if len(d) > 0 else 0))
	k = 1 + 2 * k
for _ in range(int(input())):
	num = int(input())
	ans = 0
	for i in d:
		if i <= num:
			ans = i
	print(d.index(ans) + 1)


for _ in range(int(input())):
	n = int(input())
	p = a = 0
	k = 1 << p
	while a <= n:
		a += k * (2 * k - 1)
		k <<= 1
		p += 1
	print(p - 1)


import sys

def I():
	return int(sys.stdin.readline().rstrip())
t = I()
A = [0] * 31
for i in range(1, 31):
	A[i] = 2 ** (i - 1) * (2 ** i - 1)
for i in range(1, 31):
	A[i] += A[i - 1]
for _ in range(t):
	x = I()
	a = 0
	ans = 0
	for i in range(1, 31):
		if x >= A[i]:
			ans += 1
		else:
			break
	print(ans)


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


cases = int(input())
for t in range(cases):
	x = int(input())
	i = 1
	v = 2 ** i - 1
	s = 1
	ns = 0
	while x >= s:
		ns += 1
		x -= s
		i += 1
		v = 2 ** i - 1
		s1 = (2 ** (i - 1)) ** 2 + 2 * s
		s = s1
	print(ns)


for j in range(int(input())):
	x = int(input())
	i = 0
	n = 1
	while x >= n:
		i += 1
		x -= n
		n = 2 * n + 2 ** i * 2 ** i
	print(i)


cellsNeeded = []
powNum = 2
while powNum < 10 ** 20:
	temp = powNum - 1
	cellsNeeded.append(temp * (1 + temp) // 2)
	powNum *= 2
pref = [0]
for i in range(len(cellsNeeded)):
	pref.append(pref[-1] + cellsNeeded[i])
for _ in range(int(input())):
	x = int(input())
	for i in range(len(pref) - 1, -1, -1):
		if pref[i] <= x:
			print(i)
			break


from math import log

def cub(n):
	return (1 + n) * n // 2
q = int(input())
while q:
	q -= 1
	n = int(input())
	x = 0
	while n >= cub((1 << x + 1) - 1):
		x += 1
		n -= cub((1 << x) - 1)
	print(x)


from math import pow
t = int(input())
for _ in range(t):
	n = int(input())
	ans = 0
	for i in range(1, 31):
		temp = pow(2, i) - 1
		temp = int(temp * (temp + 1) // 2)
		if temp <= n:
			ans += 1
			n -= temp
		else:
			break
	print(ans)


t = int(input())
arr = [1]
for i in range(1, 32):
	arr.append((2 ** i) ** 2 + 2 * arr[i - 1])
while t > 0:
	t -= 1
	x = int(input())
	count = 1
	x = x - 1
	i = 1
	while x > 0:
		x = x - arr[i]
		i += 1
		if x >= 0:
			count += 1
	print(count)


def isnice(n):
	deep = 1
	need = n * (n + 1) / 2
	while need > 0:
		x = n // 2 + 1
		need -= deep * x * x
		n -= x
		deep *= 2
	if need == 0:
		return True
	else:
		return False
n = int(input())
for i in range(n):
	cells = int(input())
	n = 1
	count = 0
	while n * (n + 1) / 2 <= cells:
		count += 1
		cells -= n * (n + 1) // 2
		n = n * 2 + 1
	print(count)


t = int(input())
for game in range(t):
	x = int(input())
	val = 1
	power = 2
	count = 0
	while val <= x:
		count += 1
		x -= val
		val = 2 * val + power ** 2
		power *= 2
	print(count)


for _ in range(int(input())):
	x = int(input())
	z = 2
	count = 0
	for k in range(1, x + 1):
		n = z - 1
		s = n * (n + 1) // 2
		if x < s:
			break
		x -= s
		count += 1
		z = z * 2
	print(count)


import sys, os, io
input = sys.stdin.readline
lis = [1]
for i in range(2, 40):
	n = pow(2, i) - 1
	lis.append(lis[-1] + n * (n + 1) // 2)
T = int(input())
ans = [0] * T
for t in range(T):
	x = int(input())
	for i in range(60):
		if lis[i] > x:
			ans[t] = i
			break
print(*ans, sep='\n')


num = [1]
for j in range(2, 33):
	num.append(num[-1] + (2 ** j - 1) * 2 ** j // 2)
for _ in range(int(input())):
	x = int(input())
	i = 0
	while x >= num[i]:
		i += 1
	print(i)


from sys import stdin
N = int(stdin.readline())
for stair in range(N):
	cells = int(stdin.readline())
	i = 1
	count = 0
	cost = i * (i + 1) // 2
	total = 0
	while total <= cells:
		total += cost
		i = 2 * i + 1
		cost = i * (i + 1) // 2
		count += 1
	print(count - 1)


import math

def solve(n):
	result = 0
	size = 1
	cells = 1
	while cells <= n:
		result += 1
		n -= cells
		size *= 2
		cells = (size * 2 - 1) * size
	return result
N = int(input())
for i in range(N):
	n = int(input())
	print(solve(n))


l = [1]
for i in range(60):
	l.append(l[-1] * 2 + 1)
t = int(input())
for _ in range(t):
	n = int(input())
	s = 0
	c = 0
	while s < n:
		s += l[c] * (l[c] + 1) // 2
		c += 1
	if s > n:
		c -= 1
	print(c)


import bisect
d = []
k = 1
while k <= 2000000000.0:
	d.append(k * (k + 1) // 2 + (d[-1] if len(d) > 0 else 0))
	k = 1 + 2 * k
for _ in range(int(input())):
	num = int(input())
	z = bisect.bisect(d, num, lo=0, hi=len(d))
	print(z)


t = int(input())
for _ in range(t):
	max_cells = int(input())
	sum_cells = 0
	columns = 1
	i = 0
	while sum_cells <= max_cells:
		sum_cells += columns ** 2 // 2 + columns // 2 + 1
		columns = columns * 2 + 1
		i += 1
	print(i - 1)


for t in range(int(input())):
	n = int(input())
	count = 0
	size = 1
	amo = 1
	while n >= amo:
		n -= amo
		count += 1
		size = size * 2 + 1
		amo = size * (size + 1) // 2
	print(count)


from sys import stdin
input = stdin.readline
a = [1, 3, 7]
for i in range(40):
	a.append(a[-1] + a[-1] + 1)
a = [i * (i + 1) // 2 for i in a]
for _ in range(int(input())):
	x = int(input())
	y = 0
	c = 0
	for i in a:
		if y + i > x:
			break
		y += i
		c += 1
	print(c)


def formula(x):
	return sr[x]
ar = [0] * 60
r2 = 2
for i in range(1, 60):
	ar[i] = (r2 - 1) * r2 // 2
	r2 *= 2
sr = [0] * 60
sr[1] = ar[1]
for i in range(2, 60):
	sr[i] = sr[i - 1] + ar[i]
t = int(input())
for _ in range(t):
	x = int(input())
	l = 0
	r = 60
	best = 0
	while l <= r:
		mid = l + (r - l) // 2
		if formula(mid) <= x:
			best = max(best, mid)
			l = mid + 1
		else:
			r = mid - 1
	print(best)


ar = []
r = 1
while 1:
	x = r * (r + 1) // 2
	if x > 1e+20:
		break
	ar.append(x)
	r = r * 2 + 1
t = int(input())
for a0 in range(t):
	x = int(input())
	r = 0
	while x > 0:
		r += 1
		x -= ar[r]
	print(r)


a = [1]
b = [0]
i = 2
while b[-1] <= 10 ** 18:
	a.append(a[-1] + i)
	b.append(a[-2] * (a[-2] + 1) // 2)
	i *= 2
b = b[1:]
for _ in range(int(input())):
	n = int(input())
	sum = 0
	for i in range(len(b)):
		if sum + b[i] > n:
			break
		else:
			sum += b[i]
	print(i)


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop, heapify
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
from itertools import accumulate
from functools import lru_cache
M = mod = 998244353

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

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
l1 = 0

def make():
	global l1
	start = 2
	l1 = [1]
	for i in range(2, 32):
		curr = start * start
		temp = 2 * l1[-1]
		l1.append(temp + curr)
		start *= 2
	l1 = list(accumulate(l1))
make()
for _ in range(val()):
	n = val()
	ans = 0
	for (ind, i) in enumerate(l1):
		if n >= i:
			ans = ind + 1
	print(ans)


test = int(input())
for i in range(test):
	n = int(input())
	s = 0
	cnt = 0
	for i in range(0, 100):
		s += pow(2, i)
		if n - s * (s + 1) // 2 < 0:
			break
		n -= s * (s + 1) // 2
		cnt += 1
	print(cnt)


t = int(input())
while t > 0:
	x = int(input())
	ans = 0
	lth = 1
	p = 1
	while x > 0:
		square_req = lth * (lth + 1) // 2
		if square_req > x:
			break
		else:
			x = x - square_req
			p = p * 2
			lth = lth + p
			ans = ans + 1
	print(ans)
	t = t - 1


T = int(input())
for _ in range(0, T):
	x = int(input())
	ans = 0
	tot = 0
	for i in range(1, 40):
		tt = 2 ** i - 1
		tot += tt * (tt + 1) // 2
		if tot > x:
			break
		else:
			ans = i
	print(ans)


for i in range(int(input())):
	x = int(input())
	count = 0
	stair = 1
	cell = 1
	while x - cell >= 0:
		x = x - cell
		count += 1
		stair = stair * 2 + 1
		cell = stair * (stair + 1) // 2
	print(count)


inf = int(1e+18)
t = int(input(''))
arr = []
for i in range(t):
	arr.append(int(input('')))
for i in arr:
	x = i
	sol = 0
	n = 1
	while x > 0:
		x -= n * (n + 1) // 2
		n = 2 * n + 1
		if x >= 0:
			sol += 1
	print(sol)


import math

def stairs(c):
	x = 1
	i = 0
	a = 0
	n = 1
	while a < c:
		sgp = 2 ** n - 1
		a += sgp * (sgp + 1) // 2
		x *= 2
		i += 1
		n += 1
	if a > c:
		i -= 1
	return i
t = int(input())
for x in range(t):
	print(stairs(int(input())))


import math
for j in range(int(input())):
	n = int(input())
	s = 0
	cnt = 1
	while s <= n:
		s += 2 ** (cnt - 1) * (2 ** cnt - 1)
		cnt += 1
	print(cnt - 2)


test_cases = int(input())
for test_case in range(test_cases):
	x = int(input())
	a = 0
	sum = 0
	ans = 0
	while x >= a:
		b = a
		a = a + a + 1
		diff = a - b
		sum = diff ** 2 + 2 * sum
		x -= sum
		if x >= 0:
			ans += 1
		else:
			break
	print(ans)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
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')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 10 ** 9 + 7
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
have = [1]
x = 2
for i in range(60):
	x *= 2
	here = x - 1
	have.append(here * (here + 1) // 2 + have[-1])
for _ in range(Int()):
	n = Int()
	ans = bisect_right(have, n)
	print(ans)


for _ in range(int(input())):
	x = int(input())
	n = 0
	total = 0
	i = 1
	temp = 1
	while n < x:
		n += temp * (temp + 1) // 2
		total += 1
		temp += pow(2, i)
		i += 1
	if n > x:
		total -= 1
	print(total)


t = int(input())
for _ in range(t):
	n = int(input())
	count = 0
	ans = 1
	tot = 0
	steps = 0
	for i in range(1, 61):
		ans = ans * 2
		tot += (ans - 1) * ans // 2
		if tot <= n:
			steps += 1
	print(steps)


t = int(input())
for kk in range(t):
	x = int(input())
	cur_sum = 0
	k = 1
	while True:
		cur_sum += 2 ** (2 * k - 1) - 2 ** (k - 1)
		if cur_sum > x:
			break
		k += 1
	print(k - 1)


for t in range(int(input())):
	x = int(input())
	arr = []
	for i in range(32):
		arr.append(2 ** i)
	for i in range(32):
		sp = arr[i] * (arr[i] - 1) // 2
		arr[i] = sp
	cnt = 0
	for i in range(32):
		if x - arr[i] < 0:
			break
		x -= arr[i]
		cnt += 1
	print(cnt - 1)


def myfunc(n):
	return 2 ** (n - 1) * (2 ** n - 1)
for _ in range(int(input())):
	x = int(input())
	ans = 1
	if x == 1:
		print(ans)
	else:
		cv = myfunc(ans)
		while cv <= x:
			x -= cv
			ans += 1
			cv = myfunc(ans)
		print(ans - 1)


t = int(input())
for q in range(t):
	n = int(input())
	now = 1
	prev = 0
	ans = 0
	temp = now ** 2 + prev * 2
	while n >= temp:
		n -= temp
		ans += 1
		now *= 2
		prev = temp
		temp = now ** 2 + prev * 2
	print(ans)


def precalc():
	k = 1
	arr = [0]
	while arr[-1] < 10 ** 18:
		s = (1 << k) - 1
		t = s * (s + 1) // 2
		arr.append(t + arr[-1])
		k += 1
	return arr[1:]

def main(arr):
	x = int(input())
	i = 0
	while arr[i] <= x:
		i += 1
	print(i)
for _ in range(int(input())):
	arr = precalc()
	main(arr)


for tt in range(int(input())):
	x = int(input())
	n = 0
	powTwo = 2
	while x > 0:
		sqs = powTwo * (powTwo - 1) // 2
		x -= sqs
		powTwo *= 2
		if x >= 0:
			n += 1
	print(n)


ladder = [1, 7]
for i in range(30):
	x = 6 * ladder[-1] - 8 * ladder[-2] + 1
	ladder.append(x)
t = int(input())
while t:
	t -= 1
	n = int(input())
	for i in range(60):
		if ladder[i] > n:
			print(i)
			break


def get_num(n):
	res = (n + 1) * n // 2
	return res
assert get_num(4) == 10
for _ in range(int(input())):
	n = int(input())
	cur = 2
	cnt = 0
	while get_num(cur - 1) <= n:
		n -= get_num(cur - 1)
		cnt += 1
		cur *= 2
	print(cnt)


from math import log2
t = int(input())
a = []
for j in range(1, 64):
	a.append(pow(2, j) - 1)
for i in range(t):
	x = int(input())
	k = 0
	for j in range(len(a)):
		if x - a[j] * (a[j] + 1) // 2 >= 0:
			x -= a[j] * (a[j] + 1) // 2
			k += 1
		else:
			break
	print(k)


a = []
s = 0
x = 2
while s <= 10 ** 18:
	s += x * (x - 1) // 2
	a.append(s)
	x *= 2
for _ in range(int(input())):
	m = int(input())
	ans = 0
	for i in a:
		if i > m:
			break
		ans += 1
	print(ans)


from math import ceil
from decimal import *

def get_ans(x):
	ans = 0
	i = 1
	c = 0
	while x > 0:
		ans += 1
		x -= i * 2 ** c
		c += 1
		i = 2 * i + 1
	if x < 0:
		ans -= 1
	return ans

def dfs(G, v, curr):
	v.append(curr)
	max_d = 1
	v_max_d = []
	tr = False
	for node in range(n):
		if G[curr][node] != -1:
			if node not in v:
				tr = True
				d_v = dfs(G, v, node)
				if d_v[0] + 1 > max_d:
					max_d = d_v[0] + 1
					v_max_d = d_v[1]
	if not tr:
		return (1, v)
	return (max_d, v_max_d)

def bfs(G, start):
	v = []
	querry = []
	v.append(start)
	querry.append(start)
	depth = 0
	while querry:
		depth += 1
		curr = querry.pop(0)
		for node in range(n):
			if G[curr][node] != -1 and node not in v:
				v.append(node)
				querry.append(node)
	return (depth, v)
t = int(input())
anss = []
for _ in range(t):
	x = int(input())
	anss.append(get_ans(x))
for i in anss:
	print(i)


def ns(n):
	if n == 1:
		return 1
	else:
		return 2 * ns(n - 1) + 4 ** (n - 1)
x = int(input())
for i in range(x):
	m = int(input())
	n = 1
	while m >= 0:
		m = m - ns(n)
		n = n + 1
	print(n - 2)


t = int(input())
l = [1, 7, 35, 155, 651, 2667, 10795, 43435, 174251, 698027, 2794155, 11180715, 44731051, 178940587, 715795115, 2863245995, 11453115051, 45812722347, 183251413675, 733006703275, 2932028910251, 11728119835307, 46912487729835, 187649967696555, 750599904340651, 3002399684471467, 12009598872103595, 48038395756849835, 192153583564270251, 768614335330822827]
for i in range(t):
	n = int(input())
	if n >= 768614335330822827:
		print(30)
	else:
		j = 0
		while n >= l[j]:
			j += 1
		print(j)


from sys import stdin, stdout
input = stdin.readline
print = lambda x: stdout.write(str(x) + '\n')
for _ in range(int(input())):
	x = int(input())
	i = 1
	ans = 0
	while x >= i * i - (i * i - i) // 2:
		ans += 1
		x -= i * i - (i * i - i) // 2
		i *= 2
		i += 1
	print(ans)


import math
t = int(input())
for w in range(t):
	n = int(input())
	a = 1
	c = 0
	s = 0
	while s + a * (a + 1) // 2 <= n:
		s += a * (a + 1) // 2
		a = 2 * a + 1
		c += 1
	print(c)


t = int(input())
for _ in range(t):
	n = int(input())
	i = 1
	ans = 0
	while True:
		x = 2 ** i - 1
		occ = x * (x + 1) // 2
		if n >= occ:
			ans += 1
			n -= occ
			i += 1
		else:
			print(ans)
			break


t = int(input())
for ii in range(t):
	n = int(input())
	x = 1
	s = 0
	d = 0
	while s <= n:
		x *= 2
		s += x * (x - 1) // 2
		d += 1
		if s > n:
			d -= 1
			break
	print(d)


for _ in range(int(input())):
	x = int(input())
	count = 0
	val = 1
	while x > 0:
		req = val ** 2 + val * (val - 1)
		val *= 2
		if x >= req:
			count += 1
			x -= req
		else:
			break
	print(count)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	a = math.log2(n + 1)
	k = 0
	if n == 1:
		print(1)
	else:
		(ans, m) = (0, k)
		for i in range(1, int(a) + 1):
			m = k
			k = 4 * (4 ** i - 1) // 3 - 2 ** (i + 1) + 2
			if k <= 2 * n:
				ans = i
			else:
				break
		print(ans)


dp = []
cnt = 0
s = 0
for i in range(30):
	curr = 2 ** cnt
	s += curr
	dp.append(s * (s + 1) // 2)
	cnt += 1
for _ in range(int(input())):
	n = int(input())
	ss = 0
	ccc = 0
	for i in range(len(dp)):
		if ss + dp[i] > n:
			break
		else:
			ss += dp[i]
			ccc += 1
	print(ccc)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

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

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = I()
	rr = []
	for _ in range(t):
		n = I()
		r = 0
		k = 1
		for i in range(1, 40):
			if k > n:
				break
			n -= k
			r += 1
			k = k * 2 + (2 ** i) ** 2
		rr.append(r)
	return JA(rr, '\n')
print(main())


from sys import stdin
tt = int(stdin.readline())
for loop in range(tt):
	n = int(stdin.readline())
	ans = 0
	now = 0
	for i in range(100):
		now = now * 2 + (2 ** i) ** 2
		if now <= n:
			ans += 1
			n -= now
		else:
			break
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	s = 0
	x = 1
	count = 0
	while s < n:
		s += x * (x + 1) // 2
		count += 1
		x = 2 * x + 1
	if s == n:
		print(count)
	else:
		print(count - 1)


for _ in range(int(input())):
	a = int(input())
	count = 0
	cur = 1
	while a >= 0:
		count += 1
		a -= cur * (cur + 1) // 2
		cur = 2 * cur + 1
	print(count - 1)


lst = [1, 6, 28, 120, 496, 2016, 8128, 32640, 130816, 523776, 2096128, 8386560, 33550336, 134209536, 536854528, 2147450880, 8589869056, 34359607296, 137438691328, 549755289600, 2199022206976, 8796090925056, 35184367894528, 140737479966720, 562949936644096, 2251799780130816, 9007199187632128, 36028796884746240, 144115187807420416, 576460751766552576]
for y in range(int(input())):
	n = int(input())
	cnt = 0
	summ = 0
	for i in lst:
		summ += i
		if summ > n:
			break
		cnt += 1
	print(cnt)


list = []
for i in range(33):
	cas = pow(2, i) - 1
	list.append((1 + cas) * cas // 2)
T = int(input())
for Case in range(T):
	n = int(input())
	sum = cnt = 0
	for i in range(1, 33):
		if sum + list[i] <= n:
			sum += list[i]
			cnt += 1
		else:
			break
	print(cnt)


t = int(input())
q = []
for i in range(t):
	x = int(input())
	count = 0
	n = 1
	while (pow(2, n) - 1) * pow(2, n - 1) <= x:
		count += 1
		x -= (pow(2, n) - 1) * pow(2, n - 1)
		n += 1
	q.append(count)
for i in q:
	print(i)


import math
for _ in range(int(input())):
	n = int(input())
	x = 2
	ans = 1
	c = 1
	while c <= n:
		x = x * 2
		c += (x - 1) * x // 2
		if c <= n:
			ans += 1
	print(ans)


t = int(input())
for _ in range(t):
	x = int(input())
	poschodi = 1
	out = 0
	while x > 0:
		if x >= poschodi * (poschodi + 1) // 2:
			x = x - poschodi * (poschodi + 1) // 2
			out = out + 1
			poschodi = 2 * (poschodi + 1) - 1
		else:
			break
	print(out)


for _ in range(int(input())):
	n = int(input())
	ans = 0
	va = 0
	val = 0
	i = 0
	while val <= n:
		va += pow(2, i)
		i += 1
		ans += 1
		val += va * (va + 1) // 2
	print(ans - 1)


for _ in [0] * int(input()):
	n = int(input())
	o = 0
	c = 1
	while n >= 0:
		n -= c * (c + 1) // 2
		o += 1
		c = 2 * c + 1
	print(o - 1)


def main():
	for _ in range(int(input())):
		n = int(input())
		w = -1
		i = 1
		w = 1
		l = []
		while 1:
			if n < i * (i + 1) // 2:
				break
			n -= i * (i + 1) // 2
			i = pow(2, w + 1) - 1
			w += 1
		print(w - 1)
main()


def algo(n):
	i = 1
	while n >= 0:
		k = 2 ** i - 1
		n -= k * (1 + k) // 2
		i += 1
	return i - 2
for _ in range(int(input())):
	n = int(input())
	ans = algo(n)
	print(ans)


for i in range(int(input())):
	n = int(input())
	if n > 1:
		lst = []
		lst.append(1)
		ans = 0
		now = 2
		while n > 0:
			n -= 2 * lst[now - 2] + 2 ** (2 * (now - 1))
			lst.append(2 * lst[now - 2] + 2 ** (2 * (now - 1)))
			now += 1
			ans += 1
		print(ans)
	else:
		print(1)


from collections import Counter, defaultdict as dft

def mp():
	return map(int, input().split())

def ml():
	return list(map(int, input().split()))

def solve():
	n = int(input())
	pre = 1
	c = 0
	total = 1
	x = 2
	while total <= n:
		c += 1
		pre = 2 * pre + x * x
		total += pre
		x *= 2
	print(c)
t = int(input())
for _ in range(t):
	solve()


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = 1
	ans = 0
	while a * (a + 1) // 2 <= n:
		n -= a * (a + 1) // 2
		ans += 1
		a = a * 2 + 1
	print(ans)


for f in range(int(input())):
	n = int(input())
	i = 1
	j = i
	cnt = j - 1
	while i <= n:
		cnt = cnt + 1
		j = 2 * j
		i = i + (j + 1) * (j + 2) // 2
		j = j + 1
	print(cnt)


mem = {}

def dp(pos, k):
	if k == 1:
		return int(s[0:pos])
	if (pos, k) in mem:
		return mem[pos, k]
	res = 0
	for x in range(k - 1, pos):
		res = max(res, dp(x, k - 1) * int(s[x:pos]))
	mem[pos, k] = res
	return res
for ca in range(0, int(input())):
	n = int(input())
	tot = 0
	for i in range(0, 101):
		m = 2 ** i - 1
		w = (m + 1) * m // 2
		if w <= n:
			n -= w
			tot += 1
		else:
			break
	print(tot - 1)


import sys
import math
import random
input = sys.stdin.readline

def inp():
	return int(input())

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
ara = [1]
for i in range(30):
	now = pow(2, i + 1)
	last = ara[-1]
	ara.append(now * now + 2 * last)
t = inp()
for _ in range(t):
	n = inp()
	now = 0
	for i in range(31):
		now += ara[i]
		if now > n:
			print(i)
			break


a = [0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911, 1073741823, 2147483647]
t = input()
t = int(t)
b = [0 for i in range(40)]
for i in range(1, 32):
	b[i] = a[i] * (a[i] + 1) // 2
for i in range(1, t + 1):
	x = input()
	x = int(x)
	ans = 0
	sum = 0
	for a in b:
		if sum + a <= x:
			sum += a
			ans += 1
		else:
			break
	print(ans - 1)


T = int(input())
for t in range(T):
	x = int(input())
	count = 0
	i = 1
	while 1:
		x -= i * (i + 1) // 2
		if x < 0:
			break
		count += 1
		i = 2 * i + 1
	print(count)


t = int(input())
for i in range(0, t):
	n = int(input())
	count = 1
	sum1 = 0
	while sum1 <= n:
		sum1 += 2 ** (count - 1) * (2 ** count - 1)
		count += 1
	print(count - 2)


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


king1 = [1]
for j in range(2, 33):
	king1.append(king1[-1] + (2 ** j - 1) * 2 ** j // 2)
t = int(input())
for q in range(t):
	xxxxxx = int(input())
	i = 0
	for w in range(33):
		if king1[i] > xxxxxx:
			break
		i += 1
	print(i)


from math import log2
for _ in range(int(input())):
	x = int(input())
	acc = 0
	for i in range(1, 60):
		acc += (2 ** i - 1) * 2 ** (i - 1)
		if acc > x:
			break
	print(i - 1)


from sys import stdin, stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I = lambda : map(int, stdin.readline().split())
I1 = lambda : stdin.readline()
for _ in range(int(I1())):
	n = int(I1())
	x = 1
	c = 1
	ans = 0
	while True:
		if n >= x * (x + 1) // 2:
			n -= x * (x + 1) // 2
			ans += 1
		else:
			break
		c *= 2
		x += c
	print(ans)


import sys
input = sys.stdin.readline
scan_int = lambda : int(input())
scan_string = lambda : input().rstrip()
read_list = lambda : list(read())
read = lambda : map(int, input().split())
read_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(beauty, s, n, count):
	pass
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
import bisect as bis
import random
import sys

def solve():
	n = int(input())
	s = 0
	j = 0
	c = 0
	for i in range(100):
		p = 2 ** i
		j += p
		ap = j * (j + 1) // 2
		if s + ap > n:
			break
		s += ap
		c += 1
	print(c)
for _ in range(int(input())):
	solve()


from sys import stdin, stdout
import math
t = int(stdin.readline())
tup = [1, 7]
powe = 4
for _ in range(t):
	n = int(stdin.readline())
	if tup[len(tup) - 1] <= n:
		while tup[len(tup) - 1] <= n:
			powe = powe * 2
			tup.append(tup[len(tup) - 1] + (powe - 1) * powe // 2)
		print(len(tup) - 1)
	else:
		k = len(tup) - 1
		while k > 0 and tup[k] > n:
			k -= 1
		print(k + 1)


def solve(cells):
	ans = 0
	power = 0
	prev = 0
	length = prev + 2 ** power
	while cells >= length * (length + 1) // 2:
		cells -= length * (length + 1) // 2
		prev = length
		power += 1
		ans += 1
		length = prev + 2 ** power
	return ans
for x in range(int(input())):
	print(solve(int(input())))


from sys import stdin, stdout
from math import *

def main():
	t = int(stdin.readline())
	for _ in range(t):
		x = int(stdin.readline())
		count = 0
		size = 1
		while True:
			cellrequirement = int((size + 1) * size / 2)
			if x >= cellrequirement:
				x -= cellrequirement
				count += 1
				size = size * 2 + 1
			else:
				break
		print(count)
main()


t = int(input())
kk = []
g = 2
while g <= 10 ** 10:
	kk.append((g - 1) * g // 2)
	g *= 2
while t:
	x = int(input())
	ss = 0
	res = 0
	while ss + kk[res] <= x:
		ss += kk[res]
		res += 1
	print(res)
	t -= 1


t = int(input())
j = 0
r = 0
R = []
for i in range(10 ** 5):
	j = 2 * j + 1
	s = j * (j + 1) // 2
	r += s
	R.append(r)
	if r > 10 ** 18:
		break
import bisect
for _ in range(t):
	x = int(input())
	i = bisect.bisect_right(R, x)
	print(i)


from math import ceil, log, floor, sqrt
import math
k = 1

def mod_expo(n, p, m):
	result = 1
	while p != 0:
		if p % 2 == 1:
			result = result * n % m
		p //= 2
		n = n * n % m
	return result

def min_subs(n, binary):
	(a, b) = (1, 1)
	mx = 0
	prev = not int(binary[0])
	res = [0] * n
	for i in range(n):
		if int(binary[i]) == 1:
			if int(binary[i]) == prev:
				a += 1
				b = a
			res[i] = a
		else:
			if int(binary[i]) == prev:
				b += 1
				a = b
			res[i] = b
		prev = int(binary[i])
		mx = max(mx, max(a, b))
	print(mx)
	print(*res, sep=' ')

def steps(n):
	return n // 2 + 1

def find_winner(n):
	if n % 2:
		print('black')
	else:
		print('white')
		print('1 2')

def dp_dy(x, y):
	return (125 * pow(x, 2) - pow(x, 3) - 2 * pow(x, 2) * y - 5000 * x + 150 * x * y - x * pow(y, 2) + 25 * pow(y, 2)) / (pow(x + y, 2) * pow(100 - x - y, 2))

def all_neg():
	for x in range(0, 51):
		for y in range(0, 51):
			if x + y != 100 and x + y != 0:
				print(dp_dy(x, y), x, y)
				if dp_dy(x, y) > 0:
					return False
	return True

def can_palindrome(r, g, b, w):
	no = 0
	mn = pow(10, 9) + 1
	mn = min(mn, r)
	mn = min(mn, g)
	mn = min(mn, b)
	if r % 2 == 1:
		no += 1
	if g % 2 == 1:
		no += 1
	if b % 2 == 1:
		no += 1
	if w % 2 == 1:
		no += 1
	if no <= 1:
		return True
	if no == 3 and mn > 0:
		return True
	return False

def max_find(n, k, z, a):
	res = 0
	s = 0
	mx = 0
	for t in range(z + 1):
		pos = k - 2 * t
		if pos < 0:
			continue
		mx = 0
		s = 0
		for i in range(pos + 1):
			if i < n - 1:
				mx = max(mx, a[i] + a[i + 1])
			s += a[i]
		res = max(res, s + mx * t)
	return res

def stair_count(n):
	return n * (n + 1) // 2

def count_total(n):
	count = 0
	start = 1
	while n >= stair_count(start):
		cells = stair_count(start)
		n -= cells
		count += 1
		start = 2 * start + 1
	return count
t = 1
t = int(input())
while t:
	t = t - 1
	n = int(input())
	print(count_total(n))


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
import threading
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')
t = 1
t = int(input())
while t != 0:
	t -= 1
	x = int(input())
	y = 0
	z = 0
	tot = 0
	while x >= tot:
		x -= tot
		z += 1
		y = 2 ** z - 1
		tot = int((y + 1) * y / 2)
	print(z - 1)


import sys, math
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__

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

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def solve():
	X = getInt()
	q = 1
	ans = 0
	while True:
		j = 2 ** q - 1
		if j * (j + 1) // 2 > X:
			return ans
		ans += 1
		X -= j * (j + 1) // 2
		q += 1
T = getInt()
for t in range(T):
	print(solve())


import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

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

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

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

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]
for _ in range(II()):
	x = II()
	for i in range(1, 10 ** 6):
		d = 2 ** i - 1
		s = d * (d + 1) // 2
		if s > x:
			print(i - 1)
			break
		x -= s


for _ in range(int(input())):
	x = int(input()) - 1
	n = 3
	ans = 1
	while x > 0:
		if n * (n + 1) // 2 <= x:
			x -= n * (n + 1) // 2
		else:
			break
		n = n * 2 + 1
		ans += 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l = [1]
	num = 1
	for i in range(40):
		num = 2 * num
		l.append(num ** 2 + 2 * l[-1])
	sm = [0] * len(l)
	sm[0] = l[0]
	for i in range(1, len(l)):
		sm[i] = l[i] + sm[i - 1]
	ans = 0
	for i in range(len(sm)):
		if sm[i] > n:
			ans = i
			break
	if n == 1:
		print(1)
	else:
		print(ans)


def func(n):
	if n == 1:
		print(1)
		return
	count = 1
	prev = 1
	two = 2
	n -= 1
	while 2 * prev + two ** 2 <= n:
		n -= 2 * prev + two ** 2
		count += 1
		prev = 2 * prev + two ** 2
		two *= 2
	print(count)
	return
t = int(input())
for _ in range(t):
	l = int(input())
	func(l)


def iinput():
	return [int(i) for i in input().split()]
pref = []
suma = 0
for i in range(30):
	for j in range(i, 2 * i + 1):
		suma += 2 ** j
	pref += [suma]
t = int(input())
for _ in range(t):
	x = int(input())
	for i in range(30):
		if pref[i] > x:
			print(i)
			break
	else:
		print(30)


q = int(input())
while q:
	q -= 1
	k = 1
	x = int(input())
	ans = 0
	while x - k * (k + 1) // 2 >= 0:
		ans += 1
		x -= k * (k + 1) // 2
		k = 2 * k + 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	x = 0
	c = 0
	l = []
	t = 0
	while True:
		x = x * 2 + 1
		t = x * (x + 1) // 2
		if t > n:
			break
		elif t == n:
			c = c + 1
			break
		else:
			n = n - t
			c = c + 1
	print(c)


import sys
from collections import defaultdict
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	x = 1
	c = 0
	while True:
		x *= 2
		y = x * (x - 1) // 2
		if y <= n:
			n -= y
		else:
			break
		c += 1
	print(c)


def solve():
	x = int(input())
	c = 0
	p = 1
	while p * (p + 1) // 2 <= x:
		x -= p * (p + 1) // 2
		c += 1
		p = p + p + 1
	print(c)
t = int(input())
i = 0
while i < t:
	solve()
	i += 1


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


t = int(input())
for _ in range(t):
	x = int(input())
	i = 1
	s = 0
	a = pow(2, i) - 1
	b = a * (a + 1) // 2
	while x >= b:
		s += 1
		x -= b
		i += 1
		a = pow(2, i) - 1
		b = a * (a + 1) // 2
	print(s)


import bisect
bis = bisect.bisect_right
a = 1
l = []
l.append(0)
for i in range(1, 35):
	a = a * 2
	k = a - 1
	n = k * (k + 1)
	n = n // 2
	l.append(n)
l1 = l[:]
l = [l1[0]]
for i in l1[1:]:
	l.append(i + l[-1])
for _ in range(int(input())):
	n = int(input())
	ind = 0
	ind = bis(l, n)
	ind = ind - 1
	print(ind)


import time, math as mt, bisect as bs, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

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

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

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * (2 * 10 ** 5 + 5)
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(2 * 10 ** 5 + 5):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def SPF():
	spf[1] = 1
	for i in range(2, mx + 1):
		if spf[i] == mx:
			spf[i] = i
			for j in range(i * i, mx + 1, i):
				if i < spf[j]:
					spf[j] = i
	return

def readTree(n, e):
	adj = [set() for i in range(n + 1)]
	for i in range(e):
		(u1, u2) = IP()
		adj[u1].add(u2)
	return adj
mod = 10 ** 9 + 7

def solve():
	x = II()
	tot = 0
	start = 1
	j = 1
	for i in range(1, 10000000):
		tot += start * (start + 1) // 2
		if tot > x:
			print(i - 1)
			return
		start += 2 ** j
		j += 1
t = II()
for i in range(t):
	solve()


import sys
import math

def find_sum(x):
	return x * (x + 1) // 2

def solve(n):
	num = 1
	total = 0
	while total < n:
		val = find_sum(pow(2, num) - 1)
		if total + val <= n:
			total += val
		else:
			break
		num += 1
	return num - 1
t = int(sys.stdin.readline())
ans_arr = []
for i in range(t):
	x = int(sys.stdin.readline())
	answer = solve(x)
	ans_arr.append(str(answer))
print('\n'.join(ans_arr))


t = int(input())
for i in range(t):
	x = int(input())
	base = 2
	width = base - 1
	cells = width * (width + 1) // 2
	tot = 0
	while cells <= x:
		tot += 1
		base *= 2
		width = base - 1
		cells += width * (width + 1) // 2
	print(tot)


import math
t = int(input())
w = []
for i in range(t):
	x = int(input())
	n = 1
	while (4 ** (n + 1) - 3 * 2 ** (n + 1) + 2) // 6 <= x:
		n = n + 1
	n = n - 1
	w.append(n)
for i in w:
	print(i)


def ok(x):
	return 2 ** (x - 1) * (2 ** x - 1)
t = int(input())
for test in range(t):
	x = int(input())
	a = []
	for i in range(1, 40):
		a.append(ok(i))
	sm = 0
	cnt = 0
	for z in a:
		if sm + z > x:
			break
		else:
			sm += z
			cnt += 1
	print(cnt)


for i in range(int(input())):
	n = int(input())
	ans = 0
	f = 1
	cur = 0
	z = 1
	while cur <= n:
		cur += f * (f + 1) // 2
		ans += 1
		z *= 2
		f += z
	if cur > n:
		ans -= 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	(a, s) = (0, 0)
	for i in range(1, n + 1):
		smal = 2 ** i - 1
		ssum = smal * (smal + 1) // 2
		if s + ssum > n:
			break
		s += ssum
		a += 1
	print(a)


import itertools
import math
import sys
from collections import defaultdict

def stdinWrapper():
	data = '4\n1\n8\n6\n1000000000000000000\n'
	for line in data.split('\n'):
		yield line
if '--debug' not in sys.argv:

	def stdinWrapper():
		while True:
			yield input()
inputs = stdinWrapper()

def inputWrapper():
	return next(inputs)

def getType(_type):
	return _type(inputWrapper())

def getArray(_type):
	return [_type(x) for x in inputWrapper().split()]

def solve(n):
	result = 0
	for x in range(30):
		cells = sum([pow(4, i) * pow(2, x - i) for i in range(x + 1)])
		if cells <= n:
			n -= cells
			result += 1
		else:
			break
	return result
t = getType(int)
for _ in range(t):
	n = getType(int)
	res = solve(n)
	print(res)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		n = int(input())
		start = 1
		acum = 0
		ans = 0
		while True:
			tis = (start + 1) * start // 2
			if tis + acum <= n:
				acum += tis
				ans += 1
				start += 2 ** ans
			else:
				break
		yield ans
t = int(input())
ans = gift()
print(*ans, sep='\n')


def process():
	n = int(input())
	c = 0
	sz = 1
	while sz * (sz + 1) // 2 <= n:
		c += 1
		n -= sz * (sz + 1) // 2
		sz += sz + 1
	return c
tests = int(input())
for i in range(tests):
	print(process())


import sys
import random
from fractions import Fraction
from math import *

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def finput():
	return float(input())

def tinput():
	return input().split()

def linput():
	return list(input())

def rinput():
	return map(int, tinput())

def fiinput():
	return map(float, tinput())

def rlinput():
	return list(map(int, input().split()))

def trinput():
	return tuple(rinput())

def srlinput():
	return sorted(list(map(int, input().split())))

def NOYES(fl):
	if fl:
		print('NO')
	else:
		print('YES')

def YESNO(fl):
	if fl:
		print('YES')
	else:
		print('NO')

def main():
	n = iinput()
	(s, t, res) = (1, 1, 0)
	while s <= n:
		res += 1
		n -= s
		t = 2 * t + 1
		s = t * (t + 1) // 2
	print(res)
for i in range(iinput()):
	main()


import sys

def main():
	tn = int(input())
	for ti in range(tn):
		n = int(input())
		i = 1
		ans = 0
		while n >= i * (i + 1) // 2:
			n -= i * (i + 1) // 2
			ans += 1
			i = i * 2 + 1
		print(ans)
main()


import math
n = input()
numarr = []
for i in range(int(n)):
	numarr.append(int(input()))
for num in numarr:
	count = 0
	it = 1
	while num > 0:
		cubes = 2 * (it * it) - it
		if num >= cubes:
			num -= cubes
			it *= 2
			count += 1
		else:
			break
	print(count)


def prog(x):
	return int((1 + x) * x * 0.5)
for something in range(int(input())):
	n = int(input())
	ans = 0
	i = 1
	while n >= prog(i):
		n -= prog(i)
		i = 2 * i + 1
		ans += 1
	print(ans)


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	sum = 0
	i = 0
	allsum = 0
	while True:
		sum = sum * 2 + int(2 ** i)
		allsum += sum
		if n < allsum:
			break
		i = i + 2
	print(i // 2)


for _ in range(int(input())):
	n = int(input())
	c = 0
	a = []
	for i in range(1, 31):
		v = 2 ** i - 1
		c += v * (v + 1) // 2
		a.append(c)
	c = 0
	for i in a:
		if n < i:
			break
		c += 1
	print(c)


import io
import os
from collections import Counter, defaultdict, deque

def solve(X):
	n = 1
	sizes = [1]
	while sizes[-1] <= 10 ** 18:
		sizes.append(sizes[-1] * 2 + (n + 1) * (n + 1))
		n = 2 * n + 1
	count = 0
	for x in sizes:
		if X < x:
			break
		X -= x
		count += 1
	return count
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
TC = int(input())
for tc in range(1, TC + 1):
	(X,) = [int(x) for x in input().split()]
	ans = solve(X)
	print(ans)


def solve():
	d = 1
	x = int(input())
	p = 1
	ans = 0
	while x >= d:
		x -= d
		p *= 2
		d = p * p + d * 2
		ans += 1
	print(ans)
t = int(input())
for _ in range(t):
	solve()


for _ in range(int(input())):
	n = int(input())
	s = 0
	k = 0
	for i in range(31):
		s = s + 2 ** i
		if s * (s + 1) // 2 + k == n:
			print(i + 1)
			break
		elif s * (s + 1) // 2 + k > n:
			print(i)
			break
		k = k + s * (s + 1) // 2


import math
from collections import deque
from collections import defaultdict
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	cnt = math.floor(math.log(n + 1, 2))
	arr = []
	for i in range(1, cnt + 1):
		k = (1 << i) - 1
		arr.append(k * (k + 1) // 2)
	ans = 0
	sm = 0
	for i in range(len(arr)):
		sm += arr[i]
		if sm > n:
			ans = i
			break
	if sm <= n:
		ans = len(arr)
	print(ans)


from math import log2, floor, sqrt, ceil

def ans(x):
	return ceil((sqrt(8 * x) - 1) / 2)

def fun(n):
	return int(n * (n + 1) / 2)
for _ in range(int(input())):
	N = int(input())
	p = 1
	count = 0
	while N > 0:
		N -= fun(2 ** p - 1)
		p += 1
		if N >= 0:
			count += 1
	print(count)


from sys import stdin, stdout
import math

def main():
	t = int(input())
	arr = [0]
	for m in range(60):
		arr.append((2 ** m) ** 2 + 2 * arr[-1])
	for _ in range(t):
		n = int(input())
		(i, s) = (0, 0)
		while i < len(arr):
			s += arr[i]
			if s > n:
				break
			i += 1
		print(i - 1)
main()


for ik in range(int(input())):
	n = int(input())
	t = 2
	ans = 0
	while n >= 0:
		if n >= t * (t - 1) // 2:
			n -= t * (t - 1) // 2
			t *= 2
			ans += 1
		else:
			break
	print(ans)


t = int(input())
for _ in range(t):
	x = int(input())
	ans = 0
	for d in range(1, 31):
		n = 2 ** d - 1
		x -= n * (n + 1) // 2
		if x >= 0:
			ans += 1
		if x <= 0:
			break
	print(ans)


def solve():
	n = int(input())
	p = 1
	cnt = 0
	s = 0
	while (s + p + 1) * (s + p) // 2 <= n:
		n -= (s + p + 1) * (s + p) // 2
		s += p
		p *= 2
		cnt += 1
	print(cnt)
t = int(input())
while t > 0:
	solve()
	t -= 1


def main():
	x = int(input())
	cnt = 0
	cur = 1
	while x > 0:
		if cur * (cur + 1) <= x * 2:
			cnt += 1
			x -= cur * (cur + 1) // 2
			cur = cur * 2 + 1
		else:
			break
	print(cnt)
t = int(input())
for i in range(t):
	main()


for _ in range(int(input())):
	x = int(input())
	count = 0
	while x >= 0:
		x -= 2 * (2 ** count) ** 2 - 2 ** count
		count += 1
	print(count - 1)


for i in range(int(input())):
	x = int(input())
	box = int(1)
	ans = int(0)
	while 1:
		tut = box * (box + 1) // 2
		if tut <= x:
			x -= tut
			box += box + 1
			ans += 1
		else:
			break
	print(ans)


from bisect import bisect_right
t = int(input())
a = []
s = 0
x = 2
while s <= 10 ** 18:
	s += x * (x - 1) // 2
	a.append(s)
	x *= 2
for _ in range(t):
	print(bisect_right(a, int(input())))


from itertools import count as _count
import sys as _sys

def main():
	t = int(input())
	for i_t in range(t):
		(x,) = _read_ints()
		stairs_can_build = 0
		for i_curr_stairs in _count():
			curr_stairs_n = 2 ** (i_curr_stairs + 1) - 1
			cells_need = curr_stairs_n * (curr_stairs_n + 1) // 2
			if cells_need > x:
				break
			x -= cells_need
			stairs_can_build += 1
		print(stairs_can_build)

def _read_line():
	result = _sys.stdin.readline()
	assert result[-1] == '\n'
	return result[:-1]

def _read_ints():
	return map(int, _read_line().split(' '))
main()


t = int(input())
for i in range(t):
	n = int(input())
	arr = [0 for i in range(100)]
	if n < 35:
		if n < 7:
			print(1)
		else:
			print(2)
	else:
		arr[0] = 1
		arr[1] = 3
		n = n - 7
		for i in range(2, 100):
			arr[i] = arr[i - 1] + (arr[i - 1] - arr[i - 2]) * 2
			n = n - arr[i] * (arr[i] + 1) // 2
			if n < 0:
				print(i)
				break


T = int(input())
for case in range(0, T):
	ans = 0
	n = int(input())
	k = 2
	while True:
		x = k - 1
		res = (1 + x) * x // 2
		if n >= res:
			n -= res
		else:
			break
		ans += 1
		k *= 2
	print(ans)


for t in range(int(input())):
	x = int(input())
	s = 1
	c = 0
	while s * (s + 1) // 2 <= x:
		c += 1
		x -= s * (s + 1) // 2
		s = 2 * s + 1
	print(c)


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))
output = []
t = ini()
for _ in range(t):
	n = ini()
	ans = 0
	nice = 1
	while n > 0:
		x = nice * (nice + 1) // 2
		if n - x >= 0:
			n -= x
			ans += 1
			nice = nice * 2 + 1
		else:
			break
	output.append(ans)
out(output)


T = int(input())
for Tid in range(T):
	n = int(input())
	t = 1
	ans = 0
	while n >= t * (t + 1) // 2:
		n = n - t * (t + 1) // 2
		ans = ans + 1
		t = t * 2 + 1
	print(ans)


import os, sys
from io import BytesIO, IOBase
from bisect import bisect_right

def main():
	su = [1]
	r = 3
	while su[-1] <= 10 ** 18:
		su.append(su[-1] + r * (r + 1) // 2)
		r = 2 * r + 1
	for _ in range(int(input())):
		x = int(input())
		y = bisect_right(su, x)
		print(y)
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 _ in range(t):
	n = int(input())
	consumed = 1
	reqcol = 1
	count = 1
	temp = 1
	while True:
		if n < consumed:
			count -= 1
			break
		elif n == consumed:
			break
		reqcol += temp * 2
		temp *= 2
		consumed += reqcol * (reqcol + 1) // 2
		count += 1
	print(count)


cnts = [1]
curr_2_sum = 1
csum = 1
for i in range(1, 50):
	curr_2_sum += 2 ** i
	v = (1 + curr_2_sum) * curr_2_sum // 2
	csum += v
	if csum > 10 ** 18:
		break
	else:
		cnts.append(csum)
ansl = []
for _ in range(int(input())):
	n = int(input())
	for i in range(30):
		if cnts[i] > n:
			ansl.append(i)
			break
	else:
		ansl.append(30)
for ans in ansl:
	print(ans)


import sys
import os
from io import BytesIO, IOBase
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')
mod = 10 ** 9 + 7

def lcm(x, y):
	return x * y / gcd(x, y)

def fact(x, mod=mod):
	ans = 1
	for i in range(1, x + 1):
		ans = ans * i % mod
	return ans

def arr2D(n, m, default=0):
	lst = []
	for i in range(n):
		temp = [default] * m
		lst.append(temp)
	return lst

def sortDictV(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}
from decimal import Decimal as d

def solve(n):
	i = 1
	cnt = 0
	while n >= i * (i + 1) / 2:
		n -= d(i * d(i + 1) / 2)
		i = d(i * 2) + 1
		cnt += 1
	return cnt
for _ in range(int(input())):
	n = int(input())
	print(solve(n))


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


import bisect
t = int(input())
num = 1e+18
nice = []
start = 1
s = 1
l = 1
while s < num:
	nice.append(s)
	start = (l + 1) * (l + 1) + 2 * start
	s += start
	l = l + 1 + l
nice.append(s)
while t:
	t -= 1
	n = int(input())
	s = 0
	i = 0
	print(bisect.bisect_right(nice, n))


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


import sys
import bisect
import math
from collections import deque
input = lambda : sys.stdin.readline().strip()
mod = 10 ** 9 + 7

def solve():
	n = int(input())
	(s, count, i) = (0, 0, 2)
	while s < n:
		s += (i - 1) * i // 2
		if s <= n:
			count += 1
		i *= 2
	return count
t = 1
t = int(input())
for _ in range(t):
	print(solve())


from sys import stdin, stdout

class Input:

	def __init__(self):
		self.lines = stdin.read().splitlines()
		self.idx = 0

	def line(self):
		try:
			return self.lines[self.idx]
		finally:
			self.idx += 1

	def array(self, sep=' ', cast=int):
		return list(map(cast, self.line().split(sep=sep)))

	def known_tests(self):
		(num_of_cases,) = self.array()
		for case in range(num_of_cases):
			yield self

	def unknown_tests(self):
		while self.idx < len(self.lines):
			yield self

class Problem:

	def __init__(self):
		self.oo = float('inf')

	def gcd(self, a, b):
		return a if b == 0 else self.gcd(b, a % b)

	def modpow(self, a, n, m):
		ans = 1
		while n:
			if n & 1:
				ans = ans * a % m
			n >>= 1
			a = a * a % m
		return ans

	def solve(self, n):
		ans = 0
		s = 1
		c = 1
		while n >= c:
			ans += 1
			n -= c
			c *= 2
			s *= 2
			c += s * s
		print(ans)
try:
	p = Problem()
	for tc in Input().known_tests():
		p.solve(*tc.array())
except Exception as e:
	import traceback
	traceback.print_exc(file=stdout)


a = [0, 1, 7, 35, 155, 651, 2667, 10795, 43435, 174251, 698027, 2794155, 11180715, 44731051, 178940587, 715795115, 2863245995, 11453115051, 45812722347, 183251413675, 733006703275, 2932028910251, 11728119835307, 46912487729835, 187649967696555, 750599904340651, 3002399684471467, 12009598872103595, 48038395756849835, 192153583564270251, 768614335330822827, 3074457343470774955, 12297829378178067115]
y122 = int(input())
for __ in range(y122):
	n = int(input())
	i = 0
	while a[i] <= n:
		i += 1
	print(i - 1)


import sys
inp = sys.stdin.readline
out = sys.stdout.write

def mi():
	return map(int, inp().split())

def li():
	return list(mi())

def ii():
	return int(inp())

def main():
	for _ in range(ii()):
		x = ii()
		c = 1
		o = 0
		while x >= 0:
			x -= c * (c + 1) // 2
			o += 1
			c = 2 * c + 1
		print(o - 1)
main()


def read_line():
	return list(map(int, input().split()))
asdf = []
v = 1
while v <= int(1e+18) + 5:
	asdf.append(v * (v + 1) // 2)
	v = v * 2 + 1
T = int(input())
for _ in range(T):
	n = int(input())
	ans = 0
	idx = 0
	while n > 0:
		n -= asdf[idx]
		idx += 1
		if n >= 0:
			ans += 1
	print(ans)


import math
t = int(input())
p = 0
x = 0
for r in range(t):
	n = int(input())
	l = []
	c = 0
	x = 0
	p = 0
	for i in range(100):
		x += int(math.pow(2, i))
		p = x * (x + 1) // 2
		l.append(p)
		if p >= n:
			break
	for i in range(len(l)):
		if sum(l[0:i]) <= n:
			c = i
	if len(l) == 1:
		c = 1
	print(c)


t = int(input())
a = []
t2 = 1
for i in range(1, 100):
	a.append(t2 * (2 * t2 - 1))
	t2 *= 2
for _ in range(t):
	n = int(input())
	i = 0
	while n >= a[i]:
		n -= a[i]
		i += 1
	print(i)


def read_int():
	return int(input())
t = read_int()
for case_num in range(t):
	x = read_int()
	ans = 0
	level = 1
	need = 1
	while x >= need:
		x -= need
		ans += 1
		level = level * 2 + 1
		need = level * (level + 1) // 2
	print(ans)


import sys
ii = lambda : sys.stdin.readline().strip()
idata = lambda : [int(x) for x in ii().split()]

def solve():
	ans = 0
	cnt = 1
	s = 1
	n = int(ii())
	while s <= n:
		cnt = 2 * cnt + 1
		ans += 1
		n -= s
		s = cnt * (cnt + 1) // 2
	print(ans)
	return
for t in range(int(ii())):
	solve()


t = int(input())
while t:
	t -= 1
	a = int(input())
	n = 1
	nnn = 1
	cnt = 0
	while a >= nnn:
		a -= nnn
		n = n * 2 + 1
		nnn = n * (n + 1) // 2
		cnt += 1
	print(cnt)


for i in range(int(input())):
	n = int(input())
	r = 0
	res = 0
	i = 1
	ct = 2
	while True:
		c = i * (i + 1) // 2
		if c + r <= n:
			res += 1
			r += c
		else:
			break
		i = 2 * i + 1
	print(res)


import bisect
t = int(input())
numb = [1]
cost = [1]
while cost[-1] < 10 ** 19:
	numb.append(numb[-1] * 2 + 1)
	cost.append(cost[-1] + numb[-1] * (numb[-1] + 1) // 2)
for _ in range(t):
	n = int(input())
	print(bisect.bisect_right(cost, n))


import math
for _ in range(int(input())):
	n = int(input())
	count = 0
	i = 1
	while n > 0:
		x = 2 ** i - 1
		m = x * (x + 1) // 2
		n = n - m
		if n < 0:
			break
		count += 1
		i += 1
	print(count)


import os
import sys
from io import BytesIO, IOBase

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for m in range(t):
	n = inp()
	somme = 0
	ite = 0
	u = 0
	while somme < n:
		u = 2 * u + 2 ** (2 * ite)
		somme = somme + u
		ite += 1
	if somme > n:
		ite -= 1
	print(ite)


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import random
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

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

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		ans = 0
		temp = 1
		n = I()
		i = 1
		while n > 0:
			if n >= temp:
				ans += 1
				n -= temp
				temp = 2 ** (i * 2) + 2 * temp
			else:
				break
			i += 1
		print(ans)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


from math import ceil
from sys import stdin, stdout, setrecursionlimit
from random import randint
for _ in range(int(input())):
	n = int(input())
	cur = 1
	ans = 0
	while True:
		need = cur * (cur + 1) // 2
		if need > n:
			break
		n -= need
		ans += 1
		cur = cur * 2 + 1
	print(ans)


t = int(input())
j = 1
ans = []
while 2 ** j <= 10 ** 18:
	r = 2 ** j - 1
	ans.append(r * (r + 1) // 2)
	j += 1
for i in range(t):
	n = int(input())
	tot = 0
	j = 0
	while n > 0:
		if ans[j] <= n:
			tot += 1
			n -= ans[j]
		else:
			break
		j += 1
	print(tot)


import sys
input = sys.stdin.readline

def print(val):
	sys.stdout.write(str(val) + '\n')

def prog():
	can_make = [(2 << i) - 1 for i in range(31)]
	for _ in range(int(input())):
		x = int(input())
		amt = 0
		for i in range(31):
			if x >= can_make[i] * (can_make[i] + 1) // 2:
				x -= can_make[i] * (can_make[i] + 1) // 2
				amt += 1
			else:
				break
		print(amt)
prog()


t = int(input())
for _ in range(t):
	x = int(input())
	j = 0
	a = 4
	need = 1
	while need <= x:
		j += 1
		need += a * (a - 1) // 2
		a *= 2
	print(j)


import sys
from copy import *
from bisect import *

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')
di = [[-1, 0], [1, 0], [0, 1], [0, -1]]

def inc(d, c, x=1):
	d[c] = d[c] + x if c in d else x

def bo(i):
	return ord(i) - ord('A')

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def isvalid(i, j):
	return 0 <= i < n and 0 <= j < m and (a[i][j] != '.')

def bo(i):
	return ord(i) - ord('a')

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = fi()
while t > 0:
	t -= 1
	n = fi()
	c = ans = 0
	p = 1
	while c + (p ** 2 + p) // 2 <= n:
		c += (p ** 2 + p) // 2
		ans += 1
		p = 2 * p + 1
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	curr = 1
	i = 0
	while n >= curr:
		i += 1
		n = n - curr
		curr = 2 * curr + pow(2, i) * pow(2, i)
	print(i)


pos = []
i = 1
while i < 10000000000:
	pos.append(i)
	i = i * 2 + 1
ranges = []
i = 1
j = 1
k = 1
while j < 10 ** 18:
	i = j
	j = j + pos[k] * (pos[k] + 1) // 2
	ranges.append((i, j - 1, k))
	k += 1
t = int(input())
for p in range(t):
	n = int(input())
	for k in ranges:
		if k[0] <= n and k[1] >= n:
			print(k[2])
			break


arr = [0]
for i in range(1, 61):
	num = 2 ** i - 1
	arr.append(num * (num + 1) // 2 + arr[i - 1])
t = int(input())
for _ in range(t):
	x = int(input())
	(lo, hi) = (1, 60)
	while lo < hi - 1:
		mid = (lo + hi) // 2
		if arr[mid] <= x:
			lo = mid
		else:
			hi = mid
	print(lo)


for _ in ' ' * int(input()):
	a = int(input())
	r = lambda x: x * (x + 1) // 2
	s = 1
	k = 1
	i = 1
	a -= 1
	f = 1
	while 1:
		f += 2 * i
		if r(f) <= a:
			s += 1
			a -= r(f)
			i *= 2
		else:
			break
	print(s)


for _ in range(int(input())):
	(n, ans) = (int(input()), 0)
	for i in range(1, 40):
		an = pow(2, i) - 1
		an = an * (an + 1) // 2
		if an > n:
			break
		else:
			n -= an
			ans += 1
	print(ans)


l = []
l.append(1)
for i in range(1, 34):
	l.append(2 * l[i - 1] + (2 ** i) ** 2)
for _ in range(int(input())):
	x = int(input())
	ans = 0
	temp = 0
	for i in range(34):
		if temp + l[i] <= x:
			temp += l[i]
			ans += 1
		else:
			break
	print(ans)


from functools import reduce
import os
import sys
from collections import *
from math import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def starr():
	return [str(x) for x in input().split()]

def inn():
	return int(input())

def svalue():
	return tuple(map(str, input().split()))

def parr():
	return [value() for i in range(n)]
mo = 1000000007
res = [1]
temp = 10 ** 18 + 1
for i in range(2, 60):
	sm = 2 ** i
	val = sm * (sm - 1) // 2
	res += [val + res[-1]]
for _ in range(inn()):
	n = inn()
	val = bisect_left(res, n)
	if res[val] == n:
		print(val + 1)
	else:
		print(val)


for _ in range(int(input())):
	n = int(input())
	i = 1
	stairs = 1
	res = 0
	while n > 0:
		n -= stairs ** 2 - (stairs - 1) * stairs // 2
		i *= 2
		stairs += i
		res += 1
	if n < 0:
		res -= 1
	print(res)


import math
for _ in range(int(input())):
	n = int(input())
	x = 0
	temp = 0
	p = 0
	ans = 0
	while temp <= n:
		d = pow(2, x)
		p += d
		temp1 = p * (p + 1) // 2
		temp += temp1
		ans += 1
		x += 1
	if temp > n:
		temp -= temp1
		ans -= 1
	print(ans)


from math import sqrt, log
t = int(input())
for z in range(t):
	x = int(input())
	i = 1
	n = 1
	count = 0
	while n <= x:
		count += 1
		i += 1
		x -= n
		n1 = (1 << i) - 1
		n = n1 * (n1 + 1) // 2
	print(count)


t = int(input())
for _ in range(t):
	budget = int(input())
	ans = 0
	power = 1
	while True:
		idx = 2 ** power - 1
		power += 1
		cost = idx * (idx + 1) // 2
		if cost <= budget:
			ans += 1
			budget -= cost
			if budget <= 0:
				break
		else:
			break
	print(ans)


T = int(input())
while T > 0:
	n = int(input())
	le = 1
	used = 0
	res = 0
	while used < n:
		need = (1 + le) * le // 2
		if used + need <= n:
			res += 1
		le = le * 2 + 1
		used += need
	print(res)
	T -= 1


l = []
for i in range(1, 34):
	l.append(2 ** i - 1)
x = []
for i in l:
	x.append(i * (i + 1) // 2)
t = int(input())
while t:
	t -= 1
	n = int(input())
	s = 0
	c = 0
	for i in range(0, 34):
		if s + x[i] > n:
			break
		elif s + x[i] == n:
			c += 1
			break
		else:
			s += x[i]
			c += 1
	print(c)


for _ in range(int(input())):
	x = int(input())
	prev = 0
	output = 0
	output += 1
	x -= 1
	prev = 1
	z = 4
	number = 4
	while x > 0:
		x -= 2 * prev + number
		if x >= 0:
			output += 1
		prev = number + 2 * prev
		number = number * z
	print(output)


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
A = [0]
for t in range(1, 31):
	d = (1 << t) - 1
	sum = (d + 1) * d // 2
	A.append(sum + A[-1])

def f():
	x = int(input())
	for i in range(30, 0, -1):
		if x >= A[i]:
			print(i)
			return
for t in range(int(input())):
	f()


from sys import stdin, stdout, setrecursionlimit
import heapq
from math import gcd, ceil, sqrt
from collections import Counter, deque
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
setrecursionlimit(100000)
mod = 1000000007
tc = ii1()
for _ in range(tc):
	res = 0
	n = ii1()
	cur = prev = 0
	while True:
		t = pow(2, cur) + prev
		prev = t
		req = t * (t + 1) // 2
		if n >= req:
			n -= req
			res += 1
		else:
			break
		cur += 1
	print(res)


import sys
from collections import defaultdict as dd
from collections import Counter as cc
from queue import Queue
import math
import itertools
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = lambda : sys.stdin.buffer.readline().rstrip()
k = [1]
i = 0
while k[-1] * (k[-1] + 1) // 2 < 10 ** 18:
	k.append(2 * k[-1] + 1)
for _ in range(int(input())):
	n = int(input())
	r = 0
	for i in range(len(k)):
		if n >= k[i] * (k[i] + 1) // 2:
			r = i + 1
		else:
			break
		n -= k[i] * (k[i] + 1) // 2
	print(r)


t = int(input())

def solve(x):
	cells = 0
	res = 0
	n = 1
	while cells <= x:
		need_cells = n * (n + 1) // 2
		if cells + need_cells <= x:
			res += 1
			cells += need_cells
			n = 2 * n + 1
		else:
			return res
for _ in range(t):
	x = int(input())
	print(solve(x))


l = []

def power():
	for i in range(1, 61):
		l.append(pow(2, i) - 1)
power()
for _ in range(int(input())):
	x = int(input())
	sum = 0
	c = 0
	for i in l:
		if sum < x:
			sum += i * (i + 1) // 2
			c += 1
			if sum > x:
				c -= 1
		else:
			break
	print(c)


arr = []
for i in range(1, 61):
	arr.append(2 ** i - 1)
for _ in range(int(input())):
	n = int(input())
	(s, i) = (0, 0)
	while s < n:
		s += arr[i] * (arr[i] + 1) // 2
		i += 1
	i -= s > n
	print(i)


from math import *
t = int(input())
for _ in range(t):
	n = int(input())
	ans = 0
	i = 1
	s = 0
	while n > s:
		s = s + i * (i + 1) // 2
		if s > n:
			break
		else:
			ans = ans + 1
		i = 2 * i
		i = i + 1
	print(ans)


t = 1
t = int(input())
while t:
	t -= 1
	x = int(input())
	(cnt, ans) = (0, 0)
	total = 0
	for i in range(64):
		if total + cnt * (cnt + 1) <= 2 * x:
			total += cnt * (cnt + 1)
			cnt += 1 << i
			ans += 1
		else:
			break
	print(ans - 1)


def solve():
	n = int(input())
	count = 0
	i = 1
	while True:
		s = pow(2, i) - 1
		sc = s * (s + 1) // 2
		if n >= sc:
			count += 1
			n = n - sc
		else:
			break
		i += 1
	return count
for _ in range(int(input())):
	print(solve())


def find_number_of_stairs(n):
	ans = 0
	used = 1
	vertex_len = 1
	while n >= used:
		ans += 1
		n -= used
		i = vertex_len + 1
		used = i * i + 2 * used
		vertex_len = vertex_len * 2 + 1
	return ans
t = int(input())
for i in range(t):
	n = int(input())
	print(find_number_of_stairs(n))


from collections import Counter, OrderedDict
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
import math
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
(t,) = gil()
for _ in range(t):
	(x,) = gil()
	tn = 1
	(cx, cnt) = (0, 0)
	cells = 1
	while cx + cells <= x:
		cx += cells
		cells = (tn + 1) ** 2 + 2 * cells
		tn = 2 * tn + 1
		cnt += 1
	print(cnt)


import bisect
p2 = [2 ** n - 1 for n in range(32)]
p2 = [x * (x + 1) // 2 for x in p2]
for i in range(1, 32):
	p2[i] += p2[i - 1]
for _ in range(int(input())):
	n = int(input())
	print(bisect.bisect_right(p2, n) - 1)


from bisect import *
from collections import *
from math import gcd, ceil, sqrt, floor, inf
from heapq import *
from itertools import *
from operator import add, mul, sub, xor, truediv, floordiv
from functools import *
import os
import sys
from io import BytesIO, IOBase
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 RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())
farr = [1]
ifa = []

def fact(x, mod=0):
	if mod:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr) % mod)
	else:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr))
	return farr[x]

def ifact(x, mod):
	global ifa
	ifa.append(inverse(farr[-1], mod))
	for i in range(x, 0, -1):
		ifa.append(ifa[-1] * i % mod)
	ifa = ifa[::-1]

def per(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return fact(i) // fact(i - j)
	return farr[i] * ifa[i - j] % mod

def com(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return per(i, j) // fact(j)
	return per(i, j, mod) * ifa[j] % mod

def catalan(n):
	return com(2 * n, n) // (n + 1)

def linc(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t > f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rinc(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t < f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def ldec(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t < f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rdec(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t > f(mid):
			r = mid - 1
		else:
			l = mid
	return l

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

def binfun(x):
	c = 0
	for w in arr:
		c += ceil(w / x)
	return c

def lowbit(n):
	return n & -n

def inverse(a, m):
	a %= m
	if a <= 1:
		return a
	return (1 - inverse(m, a) * m) // a % m

class BIT:

	def __init__(self, arr):
		self.arr = arr
		self.n = len(arr) - 1

	def update(self, x, v):
		while x <= self.n:
			self.arr[x] += v
			x += x & -x

	def query(self, x):
		ans = 0
		while x:
			ans += self.arr[x]
			x &= x - 1
		return ans

class smt:

	def __init__(self, l, r, arr):
		self.l = l
		self.r = r
		self.value = (1 << 31) - 1 if l < r else arr[l]
		mid = (l + r) // 2
		if l < r:
			self.left = smt(l, mid, arr)
			self.right = smt(mid + 1, r, arr)
			self.value &= self.left.value & self.right.value

	def setvalue(self, x, val):
		if self.l == self.r:
			self.value = val
			return
		mid = (self.l + self.r) // 2
		if x <= mid:
			self.left.setvalue(x, val)
		else:
			self.right.setvalue(x, val)
		self.value = self.left.value & self.right.value

	def ask(self, l, r):
		if l <= self.l and r >= self.r:
			return self.value
		val = (1 << 31) - 1
		mid = (self.l + self.r) // 2
		if l <= mid:
			val &= self.left.ask(l, r)
		if r > mid:
			val &= self.right.ask(l, r)
		return val

class DSU:

	def __init__(self, n):
		self.c = [-1] * n

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def find(self, x):
		if self.c[x] < 0:
			return x
		self.c[x] = self.find(self.c[x])
		return self.c[x]

	def union(self, u, v):
		(u, v) = (self.find(u), self.find(v))
		if u == v:
			return False
		if self.c[u] < self.c[v]:
			(u, v) = (v, u)
		self.c[u] += self.c[v]
		self.c[v] = u
		return True

	def size(self, x):
		return -self.c[self.find(x)]

class UFS:

	def __init__(self, n):
		self.parent = [i for i in range(n)]
		self.ranks = [0] * n

	def find(self, x):
		if x != self.parent[x]:
			self.parent[x] = self.find(self.parent[x])
		return self.parent[x]

	def union(self, u, v):
		(pu, pv) = (self.find(u), self.find(v))
		if pu == pv:
			return False
		if self.ranks[pu] >= self.ranks[pv]:
			self.parent[pv] = pu
			if self.ranks[pv] == self.ranks[pu]:
				self.ranks[pu] += 1
		else:
			self.parent[pu] = pv

def Prime(n):
	c = 0
	prime = []
	flag = [0] * (n + 1)
	for i in range(2, n + 1):
		if not flag[i]:
			prime.append(i)
			c += 1
		for j in range(c):
			if i * prime[j] > n:
				break
			flag[i * prime[j]] = prime[j]
			if i % prime[j] == 0:
				break
	return prime

def dij(s, graph):
	d = {}
	d[s] = 0
	heap = [(0, s)]
	seen = set()
	while heap:
		(dis, u) = heappop(heap)
		if u in seen:
			continue
		for v in graph[u]:
			if v not in d or d[v] > d[u] + graph[u][v]:
				d[v] = d[u] + graph[u][v]
				heappush(heap, (d[v], v))
	return d
t = N()
res = [1]
arr = [1]
n = 10 ** 18
while arr[-1] < n:
	res.append(res[-1] * 2 + 1)
	arr.append(res[-1] * (res[-1] + 1) // 2 + arr[-1])
for i in range(t):
	x = N()
	ind = bisect_right(arr, x)
	print(ind)


from sys import stdin, stdout
from collections import defaultdict
input = stdin.readline
l = [1]
for i in range(2, 32):
	p = 2 ** i
	l.append(l[-1] + p * (p - 1) // 2)
for _ in range(int(input())):
	x = int(input())
	for i in l:
		if i > x:
			print(l.index(i))
			break


for _ in range(int(input())):
	x = int(input())
	v = 0
	c = 0
	i = 0
	while x >= 0:
		if x - 2 * c + 2 ** i * 2 ** i >= 0:
			x -= 2 * c + 2 ** i * 2 ** i
			c = 2 * c + 2 ** i * 2 ** i
			v += 1
			i += 1
		else:
			break
	print(v - 1)


T = int(input())

def need(n):
	return n * (n + 1) // 2
for t in range(T):
	x = int(input())
	ans = 0
	nxt = 1
	while True:
		if x < need(nxt):
			break
		ans += 1
		x -= need(nxt)
		nxt = nxt * 2 + 1
	print(ans)


import sys
input = iter(sys.stdin.read().splitlines()).__next__

def solve(x):
	res = 0
	for k in range(1, 60):
		stairs = 2 ** k - 1
		cells = stairs * (stairs + 1) // 2
		if cells > x:
			break
		x -= cells
		res += 1
	return res
TC = int(input())
for tc in range(TC):
	x = int(input())
	res = solve(x)
	print(res)


from math import *
a = int(input())
for x in range(a):
	b = int(input())
	t = 1
	h = 0
	l = 1
	if b == 1:
		print(1)
	else:
		while b >= t:
			b = b - t
			h += 1
			l = l * 2 + 1
			t = ceil(l * (l + 1) / 2)
		print(h)


def solve(n):
	l = 1
	ans = 0
	p = 1
	while n > 0:
		req = l * (l + 1) // 2
		if n - req < 0:
			break
		n = n - req
		p = p * 2
		l = l + p
		ans += 1
	return ans
t = int(input())
while t:
	n = int(input())
	print(solve(n))
	t -= 1


t = int(input())
L = []
for i in range(t):
	n = int(input())
	x = 1
	y = 1
	z = 1
	ukupno = 0
	odgovor = 0
	while ukupno <= n:
		ukupno += z
		odgovor += 1
		x = z * 2
		y = y * 4
		z = x + y
	if ukupno > n:
		odgovor -= 1
	L.append(odgovor)
for i in range(len(L)):
	print(L[i])


for n in [*open(0)][1:]:
	n = int(n)
	a = c = 0
	while n >= 0:
		a += 1
		n -= c * (c + 1) // 2
		c = c * 2 + 1
	print(a - 2)


for _ in range(int(input())):
	x = int(input())
	a = 1
	n = 0
	b = 0
	while True:
		b = (a + 1) * (a // 2) + a // 2 + 1
		x -= b
		n += 1
		if x < 0:
			n -= 1
			break
		elif x == 0:
			break
		a = a * 2 + 1
	print(n)


import sys
import math
for i in range(0, int(sys.stdin.readline())):
	x = int(sys.stdin.readline())
	u = 0
	s = 0
	while s <= x:
		for k in range(u, 2 * u + 1):
			s += 2 ** k
		u += 1
	sys.stdout.write(str(u - 1) + '\n')


rw = int(input())
for wewq in range(rw):
	x = int(input())
	s = 2
	su = 0
	for i in range(1, 70):
		su += s * (s - 1) // 2
		if su > x:
			p = i - 1
			break
		s *= 2
	print(p)


for _ in range(0, int(input())):
	n = int(input())
	t = 0
	for i in range(0, 101):
		m = 2 ** i - 1
		w = (m + 1) * m // 2
		if w <= n:
			n -= w
			t += 1
		else:
			break
	print(t - 1)


import sys
input = sys.stdin.readline

def main():
	n = int(input())
	ans = 0
	stair = 1
	while n > 0:
		ans += 1
		n -= stair * (stair + 1) // 2
		stair *= 2
		stair += 1
	if n != 0:
		ans -= 1
	print(ans)
for _ in range(int(input())):
	main()


import math
for _ in range(int(input())):
	a = []
	for i in range(1, 31):
		a.append(2 ** (i - 1) * (2 ** i - 1))
	n = int(input())
	ans = 0
	s = 0
	for i in range(len(a)):
		s = s + a[i]
		if s > n:
			break
		ans += 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	(tmp, ans, t, cur) = (1, 0, 0, 1)
	while ans + tmp <= n:
		ans += tmp
		t += 1
		tmp = 4 ** t + 2 * cur
		cur = tmp
	print(t)


import math
t = int(input())
for i in range(t):
	x = int(input())
	cnt = 0
	size = 1
	while x > 0:
		a = size * (size + 1) // 2
		if x >= a:
			cnt += 1
			size = 2 * size + 1
		x -= a
	print(cnt)


import os
import heapq
import sys, threading
import math
import bisect
import operator
from collections import defaultdict
sys.setrecursionlimit(10 ** 5)
from io import BytesIO, IOBase

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def power(x, p, m):
	res = 1
	while p:
		if p & 1:
			res = res * x % m
		x = x * x % m
		p >>= 1
	return res

def inar():
	return [int(k) for k in input().split()]

def lcm(num1, num2):
	return num1 * num2 // gcd(num1, num2)

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		power = []
		ans = 0
		for i in range(1, 60):
			power.append(2 ** i - 1)
		take = 0
		div = 2 ** 60
		for i in range(len(power)):
			div = power[i] * (power[i] + 1) // 2
			if div + take > n:
				break
			ans += 1
			take += div
		print(ans)
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()


for _ in range(int(input())):
	n = int(input())
	s = 0
	i = 0
	c = 0
	while n >= 0:
		s = s + 2 ** i
		n -= s * 2 ** i
		i += 1
		if n >= 0:
			c += 1
	print(c)


t = int(input())
for _ in range(t):
	total = 0
	nice_starcases = []
	for i in range(50):
		new_square = (2 ** i) ** 2
		total = 2 * total + new_square
		nice_starcases.append(total)
	cells = int(input())
	index = 0
	while cells - nice_starcases[index] >= 0:
		cells -= nice_starcases[index]
		index += 1
	print(index)


from sys import stdin, stdout
from math import gcd, log2, log10, floor, ceil
import math
from collections import defaultdict, OrderedDict
from bisect import bisect_left

def sq(n):
	return n * (n + 1) // 2

def fun(n):
	theta = 0
	count = 0
	while n > 0:
		theta = theta * 2 + 1
		if n >= sq(theta):
			n -= sq(theta)
			count += 1
		else:
			break
	return count
for i in range(int(input())):
	n = int(input())
	answer = fun(n)
	print(answer)


t = int(input())
for testindex in range(t):
	num = int(input())
	n = x = 0
	while n <= num:
		x += 1
		m = 2 ** x - 1
		n += (m + 1) * m // 2
	print(x - 1)


def sum(n):
	n = n + 1
	return 2 ** (2 * n - 1) - 2 ** (n - 1)
array = [1]
for i in range(1, 32):
	array.append(array[i - 1] + sum(i))
for t in range(int(input())):
	x = int(input())
	for i in range(0, 32):
		if array[i] > x:
			break
	print(i)


for i in range(int(input())):
	n = int(input())
	t = 0
	total = 0
	for i in range(1, 5000000):
		total += (2 ** i - 1) * 2 ** i // 2
		t += 1
		if total > n:
			t -= 1
			print(t)
			break


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


from math import *
from random import *
from bisect import *
from math import *
cr = 1
total = []
ff = False
while True:
	total.append(cr)
	cr = cr + cr + 1
	if cr * (cr + 1) // 2 >= 10 ** 64:
		break
prefsm = [total[0]]
for i in range(1, len(total)):
	prefsm.append(prefsm[-1] + total[i] * (total[i] + 1) // 2)
for t in range(int(input())):
	n = int(input())
	l = 0
	r = len(prefsm) - 1
	if n == 1:
		print(1)
		continue
	while r - l > 1:
		m = (l + r) // 2
		if prefsm[m] <= n:
			l = m
		else:
			r = m
	print(l + 1)


def solve(n):
	i = 1
	req = 1
	count = 0
	while n >= req:
		n -= req
		i = i + (i + 1)
		req = i * (i + 1) // 2
		count += 1
	print(count)
t = int(input())
for test in range(t):
	n = int(input())
	solve(n)


a = [1]
lim = 10 ** 18
i = 0
while a[i] < lim:
	a.append(2 * a[i] + (2 ** (i + 1)) ** 2)
	i = i + 1
del a[-1]

def lowerBound(x):
	h = len(a)
	l = 0
	while l < h:
		m = l + (h - l) // 2
		if x <= a[m]:
			h = m
		else:
			l = m + 1
	return l
t = int(input())
for i in range(t):
	x = int(input())
	if x == 1:
		print(1)
		continue
	l = lowerBound(x)
	b = a[:l]
	while sum(b) > x:
		del b[-1]
	print(len(b))


for _ in range(int(input())):
	x = int(input())
	i = 1
	ans = 0
	while True:
		v = i * (i + 1) // 2
		if x < v:
			break
		x = x - v
		i = i * 2
		i = i + 1
		ans = ans + 1
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	a = -1
	x = 0
	while x <= n:
		a += 1
		k = 2 ** (a + 1) - 1
		x += k * (k + 1) // 2
	print(a)


import math
from heapq import heappush, heappop, heapify
import random
import string
from collections import deque
from bisect import bisect, bisect_left, bisect_right, insort
import sys
input = sys.stdin.readline
S = lambda : input().rstrip()
I = lambda : int(S())
M = lambda : map(int, S().split())
L = lambda : list(M())
H = 1000000000 + 7
for _ in range(I()):
	x = I()
	i = 0
	c = 0
	while True:
		s = pow(2, i)
		k = pow(2, i // 2) - 1
		s = s + k * (k + 1)
		if x < s:
			break
		x -= s
		c += 1
		i += 2
	print(c)


def f():
	t = int(input())
	arr = []
	for _ in range(t):
		arr.append(int(input()))
	for n in arr:
		(total, cursum, i) = (0, 0, 2)
		while cursum <= n:
			cursum += (i - 1) * i // 2
			i *= 2
			total += 1
		print(total - 1)
f()


def solve():
	n = int(input())
	if n == 0:
		return 0
	ans = 1
	s = 0
	i = 1
	while True:
		ele = 2 ** i - 1
		if s > n:
			break
		s += ele * (ele + 1) // 2
		ans = i
		i += 1
	return ans - 1
for _ in range(int(input())):
	print(solve())


def func(x):
	return x * (x + 1) // 2
t = int(input())
while t:
	n = int(input())
	i = '1'
	ans = 0
	while 1:
		temp = func(int(i, 2))
		if n - temp >= 0:
			ans += 1
			n -= temp
			i += '1'
		else:
			break
	print(ans)
	t -= 1


t = int(input())
while t > 0:
	x = int(input())
	n = 1
	pw2 = 1
	count = 0
	while n <= x:
		x = x - n
		count += 1
		pw2 += 1
		n = int(2 ** pw2 - 1)
		n = int(n * (n + 1) / 2)
	t = t - 1
	print(count)


from sys import *
from math import *
t = int(stdin.readline())
for _ in range(t):
	n = int(input())
	x = 1
	ans = 0
	while True:
		y = x * (x + 1) // 2
		if n >= y:
			x = x + x + 1
			ans += 1
			n -= y
		else:
			break
	print(ans)


import sys
input = sys.stdin.readline
can = []
for i in range(1, 65):
	n = 2 ** i - 1
	cnt = n * (n + 1) // 2
	can.append(cnt)
T = int(input())
for t in range(T):
	x = int(input())
	i = 0
	ans = 0
	while x > 0:
		if x - can[i] < 0:
			break
		ans += 1
		x -= can[i]
		i += 1
	print(ans)


import sys
readline = sys.stdin.readline
T = int(readline())
Ans = [0] * T
J = [1]
for _ in range(40):
	J.append(2 * J[-1] + 1)
J = [j * (j + 1) // 2 for j in J]
for i in range(1, 40):
	J[i] += J[i - 1]
for qu in range(T):
	N = int(readline())
	for i in range(40):
		if J[i + 1] > N:
			break
	Ans[qu] = i + 1
print('\n'.join(map(str, Ans)))


import sys
import math
input = sys.stdin.readline
sizes = [2 ** i - 1 for i in range(1, 32)]
blocks = [size * (size + 1) // 2 for size in sizes]
t = int(input())
for x in range(t):
	x = int(input())
	i = 0
	while x >= blocks[i]:
		x -= blocks[i]
		i += 1
	print(i)


fun = lambda x: x * (x + 1) // 2
cell_sum = [0, 1, 7, 35, 155, 651, 2667, 10795, 43435, 174251, 698027, 2794155, 11180715, 44731051, 178940587, 715795115, 2863245995, 11453115051, 45812722347, 183251413675, 733006703275, 2932028910251, 11728119835307, 46912487729835, 187649967696555, 750599904340651, 3002399684471467, 12009598872103595, 48038395756849835, 192153583564270251, 768614335330822827, 3074457343470774955]
t = int(input())
for i in range(t):
	x = int(input())
	ans = -1
	for no in cell_sum:
		if no <= x:
			ans += 1
		else:
			break
	print(ans)


def func(n):
	return n * (n + 1) // 2
for _ in range(int(input())):
	x = int(input())
	s = 0
	i = 1
	while x - func(i) >= 0:
		x -= func(i)
		i = 2 * i + 1
		s += 1
	print(s)


def nice(x):
	if x == 0:
		return 0
	prev = 1
	res = 0
	while x >= prev * (prev + 1) // 2:
		res += 1
		x -= prev * (prev + 1) // 2
		prev = prev * 2 + 1
	return res
T = int(input())
for t in range(T):
	x = int(input())
	print(nice(x))


from bisect import bisect_left, bisect_right
a = [1]
f = 1
while a[-1] <= 10 ** 18:
	f = f * 2 + 1
	a.append(a[-1] + f * (f + 1) // 2)
for _ in range(int(input())):
	n = int(input())
	print(bisect_right(a, n))


import os, sys
from io import BytesIO, IOBase
from sys import setrecursionlimit
import heapq
from math import gcd, ceil, sqrt
from collections import Counter, deque
from bisect import bisect_left, bisect_right
setrecursionlimit(100000)
mod = 1000000007

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def main():
	for _ in range(inp()):
		n = inp()
		count = 0
		val = 1
		while n >= 0:
			n -= val * (val + 1) // 2
			count += 1
			val = 2 * val + 1
		print(count - 1)
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()


def nsum(n):
	return n * (n + 1) // 2
for _ in range(int(input())):
	n = int(input())
	l = []
	s = 0
	for i in range(32):
		l.append(s + 2 ** i)
		s += 2 ** i
	out = 0
	i = 0
	while n > 0:
		if n - nsum(l[i]) >= 0:
			n -= nsum(l[i])
			out += 1
			i += 1
		else:
			break
	print(out)


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


import sys, math, cmath, time
start_time = time.time()

def solve():
	n = inp()
	s = 0
	for i in range(62):
		s = s + (2 ** (i + 1) - 1) * 2 ** (i + 1) // 2
		if s > n:
			break
	print(i)

def main():
	global tt
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	t = inp()
	for tt in range(1, t + 1):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
		sys.stdout.close()

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def counter_elements(a):
	q = dict()
	for i in range(len(a)):
		if a[i] not in q:
			q[a[i]] = 0
		q[a[i]] = q[a[i]] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q

def factors(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
			q.append(n // i)
	return list(sorted(list(set(q))))

def prime_factors(n):
	q = []
	while n % 2 == 0:
		q.append(2)
		n = n // 2
	for i in range(3, int(n ** 0.5) + 1, 2):
		while n % i == 0:
			q.append(i)
			n = n // i
	if n > 2:
		q.append(n)
	return list(sorted(q))

def transpose(a):
	(n, m) = (len(a), len(a[0]))
	b = [[0] * n for i in range(m)]
	for i in range(m):
		for j in range(n):
			b[i][j] = a[j][i]
	return b

def factorial(n, m=1000000007):
	q = 1
	for i in range(n):
		q = q * (i + 1) % m
	return q

def ceil(a, b):
	return -(-a // b)
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


for i in range(int(input())):
	n = int(input())
	res = 1
	b = 3
	n -= 1
	while b * (b + 1) // 2 <= n:
		res += 1
		n -= b * (b + 1) // 2
		b = 2 * b + 1
	print(res)


def solve():
	x = int(input())
	answer = 0
	cost = 0
	total_cost = 0
	while total_cost <= x:
		cost = 2 * cost + 2 ** (2 * answer)
		total_cost += cost
		answer += 1
	print(answer - 1)
runs = int(input())
while runs > 0:
	solve()
	runs -= 1


import math as m
i = input()
inp = []
for a in range(0, int(i)):
	inp += [int(input())]
for x in inp:
	l = 2
	c = 0
	while x > 0:
		v = l * (l - 1) // 2
		x -= v
		if x >= 0:
			c += 1
		l = 2 * l
	print(c)


def iinput():
	return int(input())

def finput():
	return float(input())

def pre():
	s = list()
	s.append(1)
	l = 2
	for _ in range(30):
		s.append(s[-1] * 2 + l * l)
		l *= 2
	return s
l = pre()
T = iinput()
for _ in range(T):
	x = iinput()
	ans = 0
	for cur in l:
		if x >= cur:
			ans += 1
			x -= cur
		else:
			print(ans)
			break


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	x = int(input())
	c = 1
	o = 0
	while x > 0:
		x -= c * (c + 1) // 2
		if x >= 0:
			o += 1
		c = 2 * c + 1
	print(o)


from math import sqrt, log
t = int(input())
for _ in range(t):
	x = int(input())
	n = 1
	while x >= 0:
		x -= (2 ** n - 1) * 2 ** n // 2
		n += 1
	print(n - 2)


import sys
input = sys.stdin.readline
import math

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])
T = inp()
t = 0
while t < T:
	t += 1
	x = inp()
	res = 0
	i = 0
	while x >= 0:
		i = i * 2 + 1
		sub = (i + 1) * i // 2
		x = x - sub
		res += 1
	print(res - 1)


from math import log2
for _ in range(int(input())):
	n = int(input())
	ans = 0
	if n == 1:
		print(1)
		continue
	for i in range(1, n):
		ans += 1
		x = 2 ** i - 1
		n -= x * (x + 1) // 2
		if n < 0:
			ans -= 1
			break
	print(ans)


t = int(input())
while t > 0:
	t -= 1
	x = int(input())
	s = 0
	k = 0
	for i in range(x):
		l = 2 ** (i + 1) - 1
		m = l * (l + 1)
		m = m // 2
		s += m
		if s > x:
			break
		else:
			k += 1
	print(k)


test = int(input())
for q in range(test):
	x = int(input())
	s = 0
	k = 1
	c = 0
	for i in range(1, 43):
		k = pow(2, i) - 1
		t = k * (k + 1) // 2
		x = x - t
		if x >= 0:
			c += 1
		else:
			break
	print(c)


import sys
input = sys.stdin.readline
t = int(input())
s = []
i = 1
M = 10 ** 18
while True:
	num = 2 * (4 ** i - 1) // 3 - 2 ** i + 1
	if num > M:
		break
	else:
		s.append(num)
		i += 1
for _ in range(t):
	n = int(input())
	ans = 0
	for i in s:
		if n >= i:
			ans += 1
		else:
			break
	print(ans)


for i in range(int(input())):
	a = int(input())
	(k, w) = (1, 1)
	counter = 1
	a -= 1
	while a >= 4 * k + 2 * w:
		counter += 1
		k = 4 * k + 2 * w
		w = 2 * w
		a -= k
	print(counter)


from sys import stdin, gettrace
if gettrace():
	inputi = input
else:

	def input():
		return next(stdin)[:-1]

	def inputi():
		return stdin.buffer.readline()

def solve():
	x = int(inputi())
	sum = 2
	n = 1
	count = 0
	while sum <= x * 2:
		count += 1
		n = n * 2 + 1
		sum += n * (n + 1)
	print(count)

def main():
	t = int(inputi())
	for _ in range(t):
		solve()
main()


import math
t = int(input())
for _ in range(t):
	n = int(input())
	a = 1
	tot = 1
	cost = 1
	ans = 1
	while n >= tot:
		a <<= 1
		cost = 2 * cost + a * a
		tot += cost
		ans += 1
	print(ans - 1)


for i in range(int(input())):
	n = int(input())
	c = 0
	b = 1
	k = 0
	sumo = 0
	while n - (c + b) * b >= 0:
		c = c + b
		n = n - c * b
		sumo = sumo + 1
		b = b * 2
	print(sumo)


a = []
base = 1
st = 1
total = 0
for i in range(40):
	total += base
	value = total * (total + 1) // 2
	a.append(value)
	base *= 2
t = int(input())
for _ in range(t):
	x = int(input())
	ans = 0
	for it in a:
		if it <= x:
			x -= it
			ans += 1
		else:
			break
	print(ans)


def Solve(n):
	sum = 0
	i = 1
	j = 0
	cur = 0
	while sum <= n:
		cur = 2 * cur + i * i
		sum += cur
		i = 2 * i
		j += 1
	print(j - 1)

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


from bisect import bisect_right
count = 0
arr = []
arr.append(1)
c = 3
while arr[-1] <= 10 ** 18:
	arr.append(arr[-1] + c * (c + 1) // 2)
	c = c * 2 + 1
for i in range(int(input())):
	n = int(input())
	t = bisect_right(arr, n)
	print(t)


def ans(arr):
	i = 1
	cnt = 0
	if arr == 1:
		return 1
	while arr - i * (i + 1) // 2 >= 0:
		cnt += 1
		ar = i * (i + 1) // 2
		arr -= ar
		tmp = 2 * i + 1
		i = tmp
	return cnt
t = int(input())
for _ in range(t):
	n = int(input())
	print(ans(n))


t = int(input())
for i in range(0, t):
	n = int(input())
	s = 1
	c = 0
	block = 1
	while block <= n:
		n = n - block
		s = 2 * s + 1
		block = s * (s + 1) // 2
		c += 1
	print(c)


def stairs(x):
	ans = 0
	index = 1
	valid_size = 1
	while x >= valid_size * (valid_size + 1) // 2:
		ans += 1
		x -= valid_size * (valid_size + 1) // 2
		index += 1
		valid_size = 2 ** index - 1
	return ans
t = int(input())
for i in range(t):
	x = int(input())
	print(stairs(x))


def f(n):
	total = 0
	other = 1
	z = 1
	totaltillnow = 0
	while totaltillnow < n:
		totaltillnow += (other + 1) * other // 2
		total += 1
		z *= 2
		other += z
	else:
		if totaltillnow > n:
			return total - 1
		else:
			return total
t = int(input())
for i in range(t):
	n = int(input())
	print(f(n))


from math import *
from bisect import *
from collections import *
from random import *
from decimal import *
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def st():
	return input().rstrip('\n')

def lis():
	return list(map(int, input().split()))

def ma():
	return map(int, input().split())
t = inp()
while t:
	t -= 1
	n = inp()
	co = 0
	so = 1
	cu = 1
	while 1:
		n -= so * (so + 1) // 2
		if n < 0:
			break
		co += 1
		cu += 1
		so = 2 ** cu - 1
	print(co)


import sys
input = sys.stdin.readline
n = int(input())
BB = [int(input()) for i in range(n)]
l = 60
A = [1]
for i in range(l - 1):
	A.append((A[-1] + 1) * 2 - 1)
B = [A[i] * (A[i] + 1) // 2 for i in range(l)]
C = [B[0]]
for i in range(1, l):
	C.append(B[i] + C[-1])
from bisect import bisect
for i in range(n):
	print(bisect(C, BB[i]))


from sys import stdin, stdout
import heapq
import cProfile
from collections import Counter, defaultdict, deque
from functools import reduce
import math
import threading
import sys
import time

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()))

def solve():
	n = get_int()
	power = 1
	ans = 0
	num = 1
	req_tiles = num * (num + 1) // 2
	while n >= req_tiles:
		n -= req_tiles
		power += 1
		num = 2 ** power - 1
		req_tiles = num * (num + 1) // 2
		ans += 1
	print(ans)

def main():
	solve()
TestCases = True
if TestCases:
	for i in range(get_int()):
		main()
else:
	main()


powers = [2 ** i for i in range(66)]
seq = [1]
cur_sum = 1
for i in range(1, 66):
	cur_sum *= 2
	cur_sum += powers[i] ** 2
	seq.append(cur_sum)
t = int(input())
for _ in range(t):
	x = int(input())
	ct = 0
	for i in seq:
		if i <= x:
			x -= i
			ct += 1
	print(ct)


t = int(input())
for _ in range(t):
	x = int(input())
	i = 1
	s = 0
	while x >= 2 ** i * (2 ** i - 1) // 2:
		s = 2 ** i * (2 ** i - 1) // 2
		x -= s
		i += 1
	print(i - 1)


import os
import sys
from io import BytesIO, IOBase
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')
import bisect
nums = [1]
ans = [1]
cv = 2
while nums[-1] < 10 ** 18:
	nums.append(nums[-1] * 2 + cv ** 2)
	ans.append(ans[-1] + nums[-1])
	cv *= 2
for j in range(int(input())):
	x = int(input())
	ind = min(bisect.bisect_left(ans, x), len(ans) - 1)
	if ans[ind] > x:
		ind -= 1
	print(ind + 1)


t = int(input())
for i in range(t):
	n = int(input())
	c = 0
	(i, a) = (1, 1)
	while n >= a * i:
		n -= i * a
		c += 1
		i = i * 2
		a += i
	print(c)


def solve(n):
	cnt = 0
	while True:
		x = 2 ** (cnt + 1) - 1
		need = x * (x + 1) // 2
		if need > n:
			break
		cnt += 1
		n -= need
	return cnt
tests = int(input())
for test in range(tests):
	n = int(input())
	print(solve(n))


t = int(input())
for _ in range(t):
	x = int(input())
	ans = 0
	sq = 2
	while x >= 0:
		x -= (sq - 1) * ((sq - 1) // 2 + 1)
		sq *= 2
		if x < 0:
			break
		ans += 1
	print(ans)


import sys
input = sys.stdin.readline
from collections import Counter

def read():
	X = int(input().strip())
	return (X,)

def solve(X, M=10000):
	cells = [1]
	cell = 1
	i = 2
	while cells[-1] <= X:
		cell = cells[-1] * 2 + (2 ** (i - 1)) ** 2
		cells.append(cell)
		i += 1
	ans = 0
	for a in cells:
		if X >= a:
			X -= a
			ans += 1
	return ans
T = int(input().strip())
for t in range(T):
	inputs = read()
	print('%s' % solve(*inputs))


for _ in range(int(input())):
	x = int(input())
	ans = 0
	for i in range(1, 40):
		temp = 2 ** i - 1
		summ = temp * (temp + 1) // 2
		if x >= summ:
			x -= summ
			ans += 1
	print(ans)


import sys
input = sys.stdin.readline
from bisect import bisect_left
from bisect import bisect_right
from math import ceil, factorial

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k, modulus=1):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
		res %= modulus
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	x = int(input())
	ans = 0
	b = 1
	while x >= b * (b + 1) // 2:
		ans += 1
		x -= b * (b + 1) // 2
		b += b + 1
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	total = 0
	calamity = 0
	for i in range(1, 501):
		j = 2 ** (i - 1)
		total *= 2
		total += j ** 2
		calamity += total
		if calamity >= n:
			break
	if calamity > n:
		print(i - 1)
	else:
		print(i)


from sys import stdin as r
input = r.readline
l = [1]
g = [1, 6]
for x in range(29):
	l.append(l[-1] * 2 + 1)
	g.append((l[-1] * 2 + 1) * ((l[-1] * 2 + 2) // 2) + [0, (l[-1] * 2 + 2) // 2][(l[-1] * 2 + 2) % 2])
for i in range(int(input())):
	n = int(input())
	i = 0
	while n >= g[i]:
		n -= g[i]
		i += 1
	print(i)


dp = [1]
curr = 2
for i in range(1, 31):
	curr = 2 ** (2 * i)
	dp.append(2 * dp[-1] + curr)
for i in range(1, 31):
	dp[i] += dp[i - 1]
for _ in range(int(input())):
	n = int(input())
	ans = 0
	for i in range(len(dp)):
		if dp[i] == n:
			ans = i + 1
			break
		elif dp[i] > n:
			ans = i
			break
	print(ans)


from sys import stdin, stdout
from bisect import bisect_left
st = lambda : list(stdin.readline().strip())
li = lambda : list(map(int, stdin.readline().split()))
mp = lambda : map(int, stdin.readline().split())
inp = lambda : int(stdin.readline())
pr = lambda n: stdout.write(str(n) + '\n')
mod = 1000000007
INF = float('inf')

def solve():
	n = inp()
	ans = 0
	i = 1
	p = 1
	while n >= i * (i + 1) // 2:
		n -= i * (i + 1) // 2
		i += pow(2, p)
		p += 1
		ans += 1
	pr(ans)
for _ in range(inp()):
	solve()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	x = int(input())
	su = 0
	ans = 0
	po = 1
	while su <= x:
		po *= 2
		su += (po - 1) * po // 2
		if su <= x:
			ans += 1
	print(ans)


import sys
readline = sys.stdin.readline
INF = 1 << 60

def read_int():
	return int(readline())

def read_int_n():
	return list(map(int, readline().split()))

def read_float():
	return float(readline())

def read_float_n():
	return list(map(float, readline().split()))

def read_str():
	return readline().strip()

def read_str_n():
	return readline().strip().split()

def ep(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.perf_counter()
		ret = f(*args, **kwargs)
		e = time.perf_counter()
		ep(e - s, 'sec')
		return ret
	return wrap

def slv(X):
	ans = 0
	n = 1
	for i in range(1, 10000000):
		m = n * (1 + n) // 2
		if m <= X:
			X -= m
			ans += 1
		else:
			break
		n += 2 ** i
	return ans

def main():
	for _ in range(read_int()):
		X = read_int()
		print(slv(X))
main()


for i in range(int(input())):
	(x, z, y, r) = (int(input()), 1, 0, 0)
	while x > 0:
		y += z
		k = y * (y + 1) // 2
		if k <= x:
			x -= k
		else:
			break
		r += 1
		z *= 2
	print(r)


from sys import stdin, stdout
t = int(stdin.readline())
for case in range(t):
	x = int(stdin.readline())
	idx = 1
	ans = 0
	while x != 0:
		stairs = (1 << idx) - 1
		cells = stairs * (stairs + 1)
		cells = cells // 2
		if x - cells < 0:
			x = 0
		else:
			ans += 1
			x -= cells
		idx += 1
	stdout.write(f'{ans}\n')


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


from sys import stdin, stdout, setrecursionlimit
import threading

class Tail_Recursion_Optimization:

	def __init__(self, recursion_limit, stack_size):
		setrecursionlimit(recursion_limit)
		threading.stack_size(stack_size)
		return None

class SOLVE:

	def solve(self):
		R = stdin.readline
		W = stdout.write
		ans = []
		stair = [0 for i in range(32)]
		for i in range(1, 32):
			stair[i] = stair[i - 1] + 2 ** (i - 1)
		for i in range(1, 32):
			stair[i] = (stair[i] ** 2 + stair[i]) // 2
		for i in range(1, 32):
			stair[i] += stair[i - 1]
		for i in range(int(R())):
			x = int(R())
			for j in range(1, 32):
				if stair[j] > x:
					ans.append(str(j - 1))
					break
		W('\n'.join(ans))
		return 0

def main():
	s = SOLVE()
	s.solve()
threading.Thread(target=main).start()


def solve(x):
	res = 0
	i = 1
	while x > 0:
		ans = pow(2, i) - 1
		temp = ans * (ans + 1) // 2
		x -= temp
		i += 1
		res += 1
	if x == 0:
		print(res)
	else:
		print(res - 1)
for _ in range(int(input())):
	n = int(input())
	solve(n)


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def solve():
	n = I()
	c = 1
	ans = 0
	while True:
		p = 2 ** c
		p -= 1
		p = p * (p + 1) // 2
		if p <= n:
			ans += 1
			n -= p
			c += 1
		else:
			break
	print(ans)
for _ in range(I()):
	solve()


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


t = int(input())
for _ in range(t):
	x = int(input())
	n = 0
	term_length = 0
	t = 0
	toa = 0
	while True:
		n += 1
		toa += term_length
		term_length = toa + 1
		t = 2 * t + term_length * term_length
		if x - t >= 0:
			x = x - t
		else:
			n = n - 1
			break
	print(n)


import sys

def inp():
	return sys.stdin.readline().rstrip('\n').encode('utf8')

def mpint():
	return map(int, sys.stdin.readline().split(' '))

def itg():
	return int(sys.stdin.readline())
for __ in range(itg()):
	x = itg()
	i = 0
	cost = 1
	ans = 0
	while x >= cost:
		ans += 1
		x -= cost
		i += 1
		cost = cost * 2 + (1 << i) ** 2
	print(ans)


import os
import sys
from io import BytesIO, IOBase
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 RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def print_list(l):
	print(' '.join(map(str, l)))
for _ in range(N()):
	n = N()
	res = 0
	now = 1
	k = 1
	while n >= now:
		res += 1
		k = k * 2 + 1
		n -= now
		now = k * (k + 1) >> 1
	print(res)


for _ in range(int(input())):
	x = int(input())
	(mul, tmp) = (1, 0)
	while x >= tmp:
		tmp = 2 ** mul - 1
		x -= tmp ** 2 // 2
		mul += 1
	print(mul - 2)


import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque
import math
from math import *

def main():
	a = [1]
	for i in range(2, 35):
		a.append(2 * a[-1] + int(pow(2, 2 * (i - 1))))
	for t in range(int(input())):
		x = int(input())
		su = 0
		j = 0
		for i in range(35):
			su += a[i]
			if su > x:
				break
			j += 1
		print(j)
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()


import sys, os.path
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
sys.setrecursionlimit(10 ** 5)

def mod():
	return 10 ** 9 + 7

def i():
	return sys.stdin.readline().strip()

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

def li():
	return list(sys.stdin.readline().strip())

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

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

def solve():
	a = ii()
	for _ in range(a):
		b = ii()
		c = 0
		while b >= 0:
			for i in range(1, 10 ** 18):
				if b - 2 ** (i - 1) * (2 ** i - 1) >= 0:
					b -= 2 ** (i - 1) * (2 ** i - 1)
					c += 1
				else:
					b -= 2 ** (i - 1) * (2 ** i - 1)
					print(c)
					break
for _ in range(1):
	solve()


def n_steps(blocks, nstairs=0, rolling_cost=0):
	rolling_cost = rolling_cost * 2 + 4 ** nstairs
	if blocks < rolling_cost:
		return nstairs
	else:
		return n_steps(blocks - rolling_cost, nstairs + 1, rolling_cost)
for i in range(int(input())):
	print(n_steps(int(input())))


def check(val):
	c = 0
	for j in range(val + 1):
		n = (1 << j) - 1
		c += (n + 1) * n // 2
	return c > x
tests = int(input())
for _ in range(tests):
	x = int(input())
	le = 0
	r = 100
	while r - le > 1:
		m = (r + le) // 2
		if check(m):
			r = m
		else:
			le = m
	print(le)


def sq_count(dim):
	count = 0
	power = 0
	while dim > 0:
		count += 2 ** power * dim ** 2
		dim = dim // 2
		power += 1
	return count

def solve(cell_count):
	inner_square_dim = 1
	count = 0
	cells_used = 0
	while True:
		cells_needed = sq_count(inner_square_dim)
		if cells_used + cells_needed > cell_count:
			return count
		cells_used += cells_needed
		inner_square_dim *= 2
		count += 1
cases = int(input())
for k in range(cases):
	cell_count = int(input())
	print(solve(cell_count))


t = int(input())
for _ in range(t):
	x = int(input())
	if x <= 6:
		print(1)
	else:
		i = 1
		t2 = 0
		while x > 0:
			t1 = 2 ** i
			if x - t1 * (t1 - 1) // 2 < 0:
				break
			else:
				t2 += 1
			x -= t1 * (t1 - 1) // 2
			i += 1
		print(t2)


for _ in range(int(input())):
	n = int(input())
	s = 0
	power2 = 2
	cnt = 0
	while s <= n:
		m = power2 - 1
		s += m * (m + 1) // 2
		power2 = power2 << 1
		cnt += 1
	print(cnt - 1)


for _ in range(int(input())):
	x = int(input())
	a = 1
	ans = 0
	total = 0
	while True:
		temp = a * (a + 1) // 2
		total += temp
		if total <= x:
			ans += 1
			a = a * 2 + 1
		else:
			break
	print(ans)


import bisect
x = []
for i in range(55):
	if i == 0:
		x.append(1)
	else:
		x.append(2 * x[-1] + 4 ** i)
s = []
for i in range(len(x)):
	if i == 0:
		s.append(1)
	else:
		s.append(s[-1] + x[i])
t = int(input())
for _ in range(t):
	p = int(input())
	j = bisect.bisect_right(s, p)
	print(j)


sum_p = [int((2 ** x - 1) * 2 ** x / 2) for x in range(1, 100)]

def main():
	x = int(input())
	out = 0
	i = 0
	while x > 0:
		x -= sum_p[i]
		i += 1
		if x >= 0:
			out += 1
		else:
			break
	print(out)
l = int(input())
for i in range(l):
	main()


def fn(x):
	if x < 1:
		return 0
	(prev, count, n) = (1, 1, 2)
	x -= 1
	while True:
		y = 2 ** (2 * n - 2) + (2 ** (n - 1) - 1) * 2 ** (n - 2) + prev
		if y > x:
			break
		x -= y
		prev = y
		count += 1
		n += 1
	return count
t = int(input())
for i in range(t):
	x = int(input())
	print(fn(x))


import sys

def input():
	return sys.stdin.readline()[:-1]

def getInt():
	return int(input())

def getIntIter():
	return map(int, input().split())

def getIntList():
	return list(getIntIter())

def flush():
	sys.stdout.flush()
for _ in range(getInt()):
	ans = 0
	upper = getInt()
	currTotal = 0
	currVal = 1
	while currTotal <= upper:
		currStair = currVal * (currVal + 1) // 2
		if currTotal + currStair <= upper:
			currTotal += currStair
			ans += 1
			currVal = currVal * 2 + 1
		else:
			break
	print(ans)


tc = int(input())
for _ in range(tc):
	c = int(input())
	summ = 0
	say = 0
	k = 0
	while c >= 0:
		summ = summ * 2 + 2 ** k
		c -= summ
		say += 1
		k += 2
	print(say - 1)


from sys import stdin
input = stdin.readline
for q in range(int(input())):
	x = int(input())
	res = 0
	p = 1
	while 1:
		y = 2 ** p - 1
		y = y * (y + 1) // 2
		if x >= y:
			x -= y
			res += 1
			p += 1
		else:
			break
	print(res)


arr = []
s = 1
i = 1
while s < 10 ** 18 + 1:
	temp = s * (s + 1) // 2
	arr.append(temp)
	s += 2 ** i
	i += 1
t = int(input())
for i in range(t):
	x = int(input())
	ans = 0
	j = 0
	while x > 0:
		if arr[j] <= x:
			x -= arr[j]
			ans += 1
		else:
			x = 0
		j += 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	s = 0
	j = 0
	c = 0
	for i in range(100):
		p = 2 ** i
		j += p
		ap = j * (j + 1) // 2
		if s + ap > n:
			break
		s += ap
		c += 1
	print(c)


from sys import stdin, stdout

def INPUT():
	return list((int(i) for i in stdin.readline().split()))

def inp():
	return stdin.readline()

def out(x):
	return stdout.write(x)
import math
import random
J = 998244353
from collections import deque
for _ in range(int(input())):
	n = int(input())
	d = 1
	ans = 0
	while n > 0:
		n -= 2 ** (d - 1) * (2 ** d - 1)
		d += 1
		if n >= 0:
			ans += 1
	print(ans)


TC = int(input())
for tc in range(TC):
	X = int(input())
	l = 1
	result = 0
	while X > 0:
		l = 2 * l + 1
		s = (l + 1) * l // 2
		X -= s
		result += 1
	print(result)


t = int(input())
v = 1
mas = [0 for i in range(60)]
mas[0] = 1
mas[1] = 3
mas[2] = 7
mas[3] = 15
mas[4] = 31
mas[5] = 63
mas[6] = 127
mas[7] = 255
mas[8] = 511
mas[9] = 1023
mas[10] = 2047
mas[11] = 4095
mas[12] = 8191
mas[13] = 16383
mas[14] = 32767
mas[15] = 65535
mas[16] = 131071
mas[17] = 262143
mas[18] = 524287
mas[19] = 1048575
mas[20] = 2097151
mas[21] = 4194303
mas[22] = 8388607
mas[23] = 16777215
mas[24] = 33554431
mas[25] = 67108863
mas[26] = 134217727
mas[27] = 268435455
mas[28] = 536870911
mas[29] = 1073741823
mas[30] = 2147483647
mas[31] = 4294967295
mas[32] = 8589934591
mas[33] = 17179869183
mas[34] = 34359738367
mas[35] = 68719476735
mas[36] = 137438953471
mas[37] = 274877906943
mas[38] = 549755813887
mas[39] = 1099511627775
mas[40] = 2199023255551
mas[41] = 4398046511103
mas[42] = 8796093022207
mas[43] = 17592186044415
mas[44] = 35184372088831
mas[45] = 70368744177663
mas[46] = 140737488355327
mas[47] = 281474976710655
mas[48] = 562949953421311
mas[49] = 1125899906842623
mas[50] = 2251799813685247
mas[51] = 4503599627370495
mas[52] = 9007199254740991
mas[53] = 18014398509481983
mas[54] = 36028797018963967
mas[55] = 72057594037927935
mas[56] = 144115188075855871
mas[57] = 288230376151711743
mas[58] = 576460752303423487
mas[59] = 1152921504606846975
for qwerty in range(t):
	n = int(input())
	v = 0
	ans = 0
	while n >= 0:
		n -= (mas[v] * mas[v] - mas[v]) // 2 + mas[v]
		v += 1
	print(v - 1)


n = 10
ans = [1]
for i in range(1, 32):
	ans.append(ans[-1] * 2 + (2 ** i) ** 2)
for i in range(1, len(ans)):
	ans[i] = ans[i] + ans[i - 1]
t = int(input())
for _ in range(t):
	num = int(input())
	j = 0
	while num >= ans[j]:
		j = j + 1
	print(j)


def func(x):
	sum = 0
	for n in range(1, 34):
		a = 2 ** n - 1
		sum += a * (a + 1) // 2
		if sum > x:
			return n - 1
for _ in range(int(input())):
	x = int(input())
	print(func(x))


import sys
from array import array
import typing as Tp

def input():
	return sys.stdin.buffer.readline().decode('utf-8')

def output(*args):
	sys.stdout.buffer.write(('\n'.join(map(str, args)) + '\n').encode('utf-8'))

def main():
	t = int(input())
	ans_a = [''] * t
	for ti in range(t):
		n = int(input()) - 1
		x = 1
		ans = 1
		while n > 0:
			x = x * 2 + 1
			if n < x * (x + 1) // 2:
				break
			n -= x * (x + 1) // 2
			ans += 1
		ans_a[ti] = str(ans)
	output(*ans_a)
main()


def getVal(s):
	return 2 ** (n + 1) - n
for _ in range(int(input())):
	n = int(input())
	i = 1
	ans = 0
	prev = 0
	while prev * 2 + i ** 2 <= n:
		n -= prev * 2 + i ** 2
		prev = prev * 2 + i ** 2
		i *= 2
		ans += 1
	print(ans)


V = []
(n, y) = (0, 0)
while y <= 10 ** 18:
	n += 1
	y = (2 ** (n + 1) - 1) * (2 ** n - 1) // 3
	V.append(y)
t = int(input())
for i in range(t):
	x = int(input())
	for (j, v) in enumerate(V):
		if v > x:
			break
	print(j)


import sys, math
input = lambda : sys.stdin.readline().rstrip()

def make(h):
	return (2 + 1 * (h - 1)) // 2 * h
for _ in range(int(input())):
	n = int(input())
	ans = 0
	if n >= 1:
		n -= 1
		ans += 1
	k = 1
	while True:
		k += 1
		n -= make(2 ** k - 1)
		if n >= 0:
			ans += 1
		else:
			break
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	ans = 0
	psum = 0
	power = 0
	while True:
		psum += 2 ** power
		power += 1
		stig = psum * (psum + 1) // 2
		n -= stig
		if n >= 0:
			ans += 1
		else:
			break
	print(ans)


def sum_till(n):
	return n * (n + 1) // 2
for _ in range(int(input())):
	tot = int(input())
	n = 1
	while True:
		req = sum_till(2 ** n - 1)
		if req > tot:
			print(n - 1)
			break
		tot -= req
		n += 1


l = []
for x in range(1, 70):
	g = (1 << x) - 1
	l.append(g * (g + 1) // 2)
for t in range(int(input())):
	x = int(input())
	i = 0
	ans = 0
	while x > 0:
		if x >= l[i]:
			x -= l[i]
			i += 1
			ans += 1
		else:
			break
	print(ans)


t = int(input())
while t > 0:
	x = int(input())
	ans = 0
	height = 1
	staircase = 1
	while x - staircase >= 0:
		x -= staircase
		ans += 1
		height = 2 * height + 1
		staircase = (height * height + height) // 2
	print(ans)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	n -= 1
	last = 1
	side = 2
	ans = 1
	while n > 0:
		a = 2 * last + side ** 2
		n -= a
		last = a
		if n >= 0:
			ans += 1
		side = 2 * side
	print(ans)


import bisect
t = int(input())
res = [1]
cum = [1]
m = 2
for i in range(2, 100):
	res.append(pow(m, 2) + 2 * res[-1])
	cum.append(res[-1] + cum[-1])
	m *= 2
for _ in range(t):
	x = int(input())
	idx = bisect.bisect_right(cum, x)
	print(idx)


n = int(input())
res = []
for i in range(n):
	num_cell = int(input())
	res_ = 0
	i = 0
	while True:
		num_cell -= 2 ** i * (2 ** (i + 1) - 1)
		if num_cell < 0:
			res.append(i)
			break
		i += 1
for i in res:
	print(i)


t = int(input())
for _ in range(t):
	n = int(input())
	a = 1
	c = 0
	k = 3
	d = 4
	while n > 0:
		if n >= a:
			n -= a
			a = k * (k + 1) // 2
			k += d
			d = d * 2
			c += 1
		else:
			n = 0
	print(c)


t = int(input())
for i in range(t):
	x = int(input())
	ans = cnt = 0
	twop = 2
	while ans + (twop - 1 + 1) * (twop - 1) // 2 <= x:
		ans += (twop - 1 + 1) * (twop - 1) // 2
		twop *= 2
		cnt += 1
	print(cnt)


import math
t = int(input())
MAX_RANGE = 64
a_vec = [1 for _ in range(MAX_RANGE)]
for i in range(2, MAX_RANGE):
	a_vec[i] = 2 * a_vec[i - 1] + 2 ** (2 * (i - 1))
a_sum = [a_vec[i] for i in range(MAX_RANGE)]
for i in range(2, MAX_RANGE):
	a_sum[i] = a_sum[i] + a_sum[i - 1]
for _ in range(t):
	x = int(input())
	for i in range(1, MAX_RANGE):
		if a_sum[i] == x:
			print(i)
			break
		elif a_sum[i] > x:
			print(i - 1)
			break


for tt in range(int(input())):
	n = int(input())
	ans = 0
	ptr = 1
	prev = 1
	while n >= prev * (prev + 1) // 2:
		n -= prev * (prev + 1) // 2
		ans += 1
		prev += pow(2, ptr)
		ptr += 1
	print(ans)


N = int(input())
for _ in range(N):
	cells = int(input())
	i = 1
	prev = 0
	x = 1
	cnt = 0
	while cells >= x:
		cells -= x
		i <<= 1
		prev = x
		x = 2 * prev + i * i
		cnt += 1
	print(cnt)


def countValue(value):
	sum = 0
	maxStair = 0
	count = 0
	while sum <= value:
		maxStair = maxStair * 2 + (2 ** count) ** 2
		sum += maxStair
		count += 1
	return count - 1

def main():
	k = int(input())
	for i in range(0, k):
		print(countValue(int(input())))
main()


import math

def isPerfectSquare(x):
	sr = math.sqrt(x)
	return sr - math.floor(sr) == 0
t = int(input())
for _ in range(t):
	x = int(input())
	ans = 0
	val = 1
	c = 2
	while True:
		if x < val * (val + 1) // 2:
			break
		if val == 1:
			x -= 1
			ans += 1
			val += 2
		else:
			x -= val * (val + 1) // 2
			ans += 1
			c *= 2
			val += c
	print(ans)


import bisect
from collections import defaultdict as dd
import sys
input = sys.stdin.readline
t = int(input())
l = [1]
inf = 10 ** 18
x = 1
while l[-1] <= inf:
	curr = 2 * x + 1
	l.append(l[-1] + curr * (curr + 1) // 2)
	x = curr
while t:
	n = int(input())
	print(bisect.bisect_right(l, n))
	t -= 1


tests = int(input())
for t in range(tests):
	n = int(input())
	k = 1
	i = 0
	count = 0
	cells = 0
	if n == 1:
		print(1)
		continue
	while n > -1:
		j = 2 ** k - 1
		n = n - j * 2 ** (k - 1)
		if n >= 0:
			count += 1
			k += 1
	print(count)


import collections
for t in range(int(input())):
	n = int(input())
	out = 0
	base = 1
	while n >= base * (base + 1) // 2:
		n -= base * (base + 1) // 2
		out += 1
		base = base * 2 + 1
	print(out)


n = int(input())
for i in range(n):
	level = 1
	x = int(input())
	count = 0
	while True:
		x -= level * (1 + level) // 2
		count += 1
		level = level * 2 + 1
		if x < 0:
			print(count - 1)
			break


t = int(input())
for _ in range(t):
	n = int(input())
	sb = [0]
	for i in range(40):
		sb.append(sb[-1] * 2 + 1)
	fuck_b = [0]
	for i in sb[1:]:
		fuck_b.append(fuck_b[-1] + (i + 1) * i // 2)
	for i in range(40):
		if n < fuck_b[i]:
			print(i - 1)
			break


tt = int(input())
for _ in range(tt):
	noOfSquares = int(input())
	totalStairs = 0
	length = 1
	p = 1
	while noOfSquares > 0:
		totalSquaresRequired = length * (length + 1) // 2
		if noOfSquares >= totalSquaresRequired:
			totalStairs += 1
			noOfSquares -= totalSquaresRequired
			p = p * 2
			length += p
		else:
			break
	print(totalStairs)


x = 1
ls = []
while x < 1e+18:
	ls.append(x)
	x *= 2
	x += 1
lsn = [0]
for i in range(len(ls)):
	lsn.append(lsn[-1] + (ls[i] * ls[i] - ls[i]) // 2 + ls[i])
t = int(input())
for i in range(t):
	x = int(input())
	i = 0
	while lsn[i + 1] <= x:
		i += 1
	print(i)


def solve(n):
	i = 1
	res = 0
	while True:
		x = 2 ** i - 1
		x = x * (x + 1) // 2
		if x <= n:
			n -= x
			res += 1
			i += 1
		else:
			break
	return res
T = int(input())
for t in range(T):
	n = int(input())
	print(solve(n))


from sys import stdin, stdout, stderr, maxsize
tup = lambda : map(int, stdin.readline().split())
I = lambda : int(stdin.readline())
lint = lambda : [int(x) for x in stdin.readline().split()]
S = lambda : stdin.readline().replace('\n', '').strip()
stpr = lambda x: stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))
from math import ceil, floor
from _collections import defaultdict
from bisect import bisect_left, bisect_right
for _ in range(I()):
	n = I()
	ans = 0
	(val, power) = (1, 2)
	while val <= n:
		ans += 1
		n -= val
		val = val * 2 + power * power
		power *= 2
	print(ans)


tests = int(input())
for t in range(tests):
	n = int(input())
	k = 1
	count = 0
	while n > -1:
		n -= (2 ** k - 1) * 2 ** (k - 1)
		if n >= 0:
			count += 1
			k += 1
	print(count)


t = int(input())
for tc in range(t):
	n = int(input())
	ans = 0
	i = 1
	while n > 0:
		poww = (1 << i) - 1
		cur = poww * (poww + 1) // 2
		if n >= cur:
			n -= cur
		else:
			break
		ans += 1
		i += 1
	print(ans)


list = []
for i in range(1, 32):
	check = 2 ** i
	list.append(int(check * (check - 1) // 2))
t = int(input())
for j in range(t):
	n = int(input())
	k = 0
	while n >= list[k]:
		n -= list[k]
		k += 1
	print(k)


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c for j in range(b)] for i in range(a)]

def list3d(a, b, c, d):
	return [[[d for k in range(c)] for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e for l in range(d)] for k in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** (-10)

def rec(sm, cnt, h, x):
	if sm > x:
		return 0
	return rec(sm + cnt * 2 + (h + 1) ** 2, cnt * 2 + (h + 1) ** 2, h * 2 + 1, x) + 1
for _ in range(INT()):
	x = INT()
	ans = rec(1, 1, 1, x)
	print(ans)


import sys
inp = sys.stdin.buffer.readline
inar = lambda : list(map(int, inp().split()))
inin = lambda : int(inp())
inst = lambda : inp().decode().rstrip('\n\r')
from bisect import bisect
st = [1]
n = 1e+18
rem = n
ans = 0
i = 1
prev = 0
used = 0
while rem > 0:
	if i * i + 2 * prev <= rem:
		rem -= i * i + 2 * prev
		ans += 1
		prev = i * i + 2 * prev
		used += prev
		i *= 2
		st.append(used)
	else:
		break
_T_ = inin()
for _t_ in range(_T_):
	n = inin()
	print(bisect(st, n) - 1)


import sys
import collections as cc
import bisect as bi
I = lambda : list(map(int, input().split()))
cur = 1

def f(x):
	return x * (x + 1) // 2
ar = [f(2 ** i - 1) for i in range(1, 32)]
for i in range(1, len(ar)):
	ar[i] += ar[i - 1]
for tc in range(int(input())):
	(n,) = I()
	temp = bi.bisect_right(ar, n)
	print(temp)


for t in range(int(input())):
	x = int(input())
	s = 1
	ans = [1]
	k = 1
	S = 1
	tt = [1]
	while S <= x:
		k = k * 2
		p = tt[-1] + k
		tt.append(p)
		ans.append((p + 1) * p // 2)
		S += ans[-1]
	if S > x:
		print(len(ans) - 1)
	else:
		print(len(ans))


l = []
for _ in range(int(input())):
	n = int(input())
	i = 1
	a = 1
	while 1:
		if n <= a * (a * 2 - 1):
			break
		else:
			n = n - a * (a * 2 - 1)
			a = a * 2
			i = i + 1
	if n == a * (a * 2 - 1):
		l.append(i)
	else:
		l.append(i - 1)
for i in l:
	print(i)


y = lambda : int(input())
for _ in range(y()):
	n = y()
	c = 0
	while 2 ** (2 * c + 1) - 2 ** c <= n:
		n -= 2 ** (2 * c + 1) - 2 ** c
		c += 1
	print(c)


for _ in range(int(input())):
	n = int(input())
	t = n
	z = 1
	while t > 0:
		p = 2 ** z - 1
		t -= p * (p + 1) // 2
		z += 1
		if t < 0:
			z -= 1
	print(z - 1)


li = [1]
i = 1
while i <= 10 ** 18:
	i = i * 2 + 1
	li.append(i)
for _ in range(int(input())):
	x = int(input())
	cnt = 0
	for i in li:
		if i * (i + 1) // 2 > x:
			break
		x -= i * (i + 1) // 2
		cnt += 1
	print(cnt)


import sys
read = sys.stdin.read
readlines = sys.stdin.readlines

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		r = 0
		t = 1
		while n:
			t2 = (t + 1) // 2 * t
			if n >= t2:
				n -= t2
				r += 1
			else:
				break
			t = t * 2 + 1
		print(r)
main()


t = int(input())
d = {1: 1}
for i in range(2, 32):
	d[i] = 2 * d[i - 1] + 2 ** (2 * (i - 1))
for _ in range(t):
	x = int(input())
	acc = 0
	for i in range(1, 32):
		acc += d[i]
		if acc > x:
			break
	print(i - 1)


from collections import defaultdict as dd
import math
import sys
input = sys.stdin.readline

def nn():
	return int(input())

def li():
	return list(input())

def mi():
	return map(int, input().split())

def lm():
	return list(map(int, input().split()))
ind = []
tot = []
for i in range(1, 34):
	req = (2 ** i - 1) * 2 ** i // 2
	ind.append(req)
	if len(tot) >= 1:
		tot.append(req + tot[-1])
	else:
		tot.append(req)

def solve():
	n = nn()
	have = 0
	while n >= tot[have]:
		have += 1
	print(have)
	return
q = nn()
for _ in range(q):
	solve()


def func(x):
	return x * (x + 1) // 2
t = int(input())
for _ in range(t):
	x = int(input())
	a = [func(2 ** i - 1) for i in range(32)]
	b = [sum(a[0:i]) for i in range(1, 33)]
	for i in range(32):
		if x < b[i]:
			print(i - 1)
			break


import math
t = int(input())
arr = []
for i in range(t):
	arr.append(int(input()))
k = 0
nice_nums = []
req_squares = []
n = 1
while True:
	val = 2 ** n - 1
	nice_nums.append(val)
	req = val * (val + 1) // 2
	if req <= 10 ** 18:
		req_squares.append(req)
	else:
		break
	n += 1
for i in range(len(arr)):
	max_cells = arr[i]
	ct = 0
	ans = 0
	for j in range(len(req_squares)):
		ct += req_squares[j]
		if ct <= max_cells:
			ans += 1
		else:
			break
	print(ans)


import sys
n = int(sys.stdin.readline().strip())
i = 1
c = 1
lol = 1
h = [1]
count = [1]
while count[-1] < 1e+19:
	h.append(2 ** (i + 1) - 1)
	count.append(2 ** (2 * i + 1) - 2 ** i)
	i += 1
for _ in range(n):
	l1 = int(sys.stdin.readline().strip())
	v = 0
	for j in range(len(count)):
		if l1 < count[j]:
			print(v)
			break
		l1 -= count[j]
		v += 1


MOD = 1000000007
from collections import defaultdict as dd, Counter, deque

def si():
	return input()

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def mi():
	return map(int, input().split())

def out(v):
	print(v)

def spout():
	print(v, end=' ')

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

def twod(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def vow():
	return ['a', 'e', 'i', 'o', 'u']

def let():
	return [chr(i) for i in range(97, 123)]

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ispow2(x):
	return x and (not x & x - 1)

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)
t = ii()
while t:
	t -= 1
	num = ii()
	s = i = 0
	while s <= num:
		n = pow(2, i) - 1
		s += n * (n + 1) // 2
		i += 1
	print(i - 2)


import os
import sys
from io import BytesIO, IOBase

def readvars():
	k = map(int, input().split())
	return k

def readlist():
	li = list(map(int, input().split()))
	return li

def anslist(li):
	ans = ' '.join([str(v) for v in li])
	return ans

def main():
	t = 1
	t = int(input())
	for xx in range(t):
		x = int(input())
		cells = 1
		slen = 1
		nums = 0
		while 1:
			side = pow(2, slen) - 1
			cells = (side ** 2 + side) // 2
			x -= cells
			if x < 0:
				break
			nums += 1
			slen += 1
		print(nums)
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()


import sys
input = sys.stdin.readline
t = int(input())
steps = [1]
sq = 1
while steps[-1] < 10 ** 20:
	sq *= 2
	steps.append(steps[-1] * 2 + sq * sq)
for _ in range(t):
	n = int(input())
	ans = 0
	for (i, item) in enumerate(steps):
		if item > n:
			break
		n -= item
		ans += 1
	print(ans)


t = int(input())
while t > 0:
	t -= 1
	x = int(input())
	c = 0
	s = 0
	while True:
		n = 2 ** c - 1
		s += n * (n + 1) // 2
		if s > x:
			break
		c += 1
	print(c - 1)


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


t = int(input())
for i in range(t):
	n = int(input())
	i = 0
	j = 1
	save = 0
	while True:
		res = j * 2 ** i
		if res > n:
			break
		else:
			save += res
			j = j * 2 + 1
			i += 1
	if n >= save:
		print(i)
	else:
		print(i - 1)


def solution(n):
	arr = [1]
	while arr[-1] <= n:
		l = 2 ** len(arr)
		arr.append(arr[-1] * 2 + l * l)
	counter = 0
	for a in arr:
		if a <= n:
			counter += 1
			n -= a
		else:
			return counter
total = int(input())
for i in range(total):
	n = int(input())
	print(solution(n))


import math
t = int(input())
while t > 0:
	x = int(input())
	p = 30
	while 2 * (pow(4, p) - 1) - 3 * pow(2, p) + 3 > 3 * x:
		p = p - 1
	print(p)
	t = t - 1


def stairs(n):
	if n == 1:
		return 1
	i = 1
	j = 1
	count = 0
	while n >= 0:
		cells = i * (i + 1) // 2
		n -= cells
		count += 1
		i += 2 ** j
		j += 1
	return count - 1
l = int(input())
for _ in range(l):
	n = int(input())
	val = stairs(n)
	print(val)


from math import sqrt
import os
import sys
from io import BytesIO, IOBase
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 prog_name():
	n = int(input())
	if n == 1:
		print(1)
	else:
		cnt = 0
		ini = 0
		while n - (pow(2, ini + 1) - 1) * pow(2, ini) >= 0:
			cnt += 1
			n -= (pow(2, ini + 1) - 1) * pow(2, ini)
			ini += 1
		print(cnt)

def main():
	t = int(input())
	for unique in range(t):
		prog_name()
main()


import sys
LI = lambda : list(map(int, sys.stdin.readline().strip('\n').split()))
MI = lambda : map(int, sys.stdin.readline().strip('\n').split())
SI = lambda : sys.stdin.readline().strip('\n')
II = lambda : int(sys.stdin.readline().strip('\n'))
arr = []
for i in range(33):
	(s, p) = (0, i)
	for j in range(i + 1):
		s += 2 ** p * (2 ** j) ** 2
		p -= 1
	arr.append(s)
for i in range(1, 33):
	arr[i] += arr[i - 1]
for _ in range(II()):
	x = II()
	for i in range(33):
		if arr[i] > x:
			break
	print(i)


inputed = []
count = int(input())

def niceK(k):
	return (2 ** k - 1) * 2 ** (k - 1)
linesPer = 1
for i in range(count * linesPer):
	inputed.append(input())
t = 0
for i in range(count):
	inputed[t] = int(inputed[t])
	cells = inputed[t]
	count = 0
	while cells >= niceK(count + 1):
		cells -= niceK(count + 1)
		count += 1
	print(count)
	t += linesPer


t = int(input())
while t:
	t = t - 1
	n = int(input())
	out = 0
	i = 1
	cnt = 0
	while out <= n:
		cnt += 1
		out += i * (i + 1) // 2
		i = i * 2 + 1
	print(cnt - 1)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192
from sys import stderr

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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def pow(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
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)))

def gcd(a, b):
	if a == b:
		return a
	while b > 0:
		(a, b) = (b, a % b)
	return a

def solve():
	n = int(inp())
	j = 1
	i = 2 ** j - 1
	req = i * (i + 1) // 2
	k = n
	c = 0
	while k >= req:
		c += 1
		k -= req
		j += 1
		i = 2 ** j - 1
		req = i * (i + 1) // 2
	print(c)
testcase(int(inp()))


import math
dp = [1]
t = 1
i = 1
while t < pow(10, 18):
	s = 2 ** i
	i += 1
	t = 2 * dp[-1] + s * s
	dp.append(t)
for _ in range(int(input())):
	n = int(input())
	s = 0
	c = 0
	for i in dp:
		if s + i > n:
			break
		s += i
		c += 1
	print(c)


t = int(input())
for _ in range(t):
	x = int(input())
	ans = 0
	i = 0
	cur = 0
	while x >= 0:
		cur += pow(2, i)
		x -= (1 + cur) * cur // 2
		ans += 1
		i += 1
	print(ans - 1)


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi
from collections import deque, defaultdict
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
for _ in range(I()):
	n = I()
	p = 1
	k = 0
	bl = 1
	while bl <= n:
		k += 1
		n -= bl
		bl = bl + bl + (p + 1) ** 2
		p += p + 1
	print(k)


for _ in range(int(input())):
	x = int(input())
	n = x
	cnt = 0
	l = 0
	for i in range(n):
		l += 2 ** i
		num = l * (l + 1) // 2
		if x >= num:
			cnt += 1
			x -= num
		else:
			break
	print(cnt)


import sys
input = lambda : sys.stdin.readline().rstrip()
a = [1]
v = [1]
for i in range(64):
	a.append(2 * a[-1] + 1)
	v.append(a[-1] * (a[-1] + 1) // 2)
for _ in range(int(input())):
	n = int(input())
	i = 0
	ans = 0
	while n >= v[i]:
		n -= v[i]
		ans += 1
		i += 1
	print(ans)


import sys
import math
from math import inf, gcd
from functools import *
from itertools import *
from collections import *
from typing import *
sys.setrecursionlimit(10 ** 7)
t = int(input())
for i in range(t):
	n = int(input())
	j = 1
	ans = 0
	while n >= (j + 1) * j // 2:
		n -= (j + 1) * j // 2
		ans += 1
		j = j * 2 + 1
	print(ans)


for k in range(int(input())):
	n = int(input())
	m = 0
	i = 1
	j = 1
	while j <= n:
		if i * (i + 1) // 2 > n:
			break
		n -= i * (i + 1) // 2
		m += 1
		i = 2 ** (j + 1) - 1
		j += 1
	print(m)


for _ in ' ' * int(input()):
	a = [6]
	n = int(input())
	i = 4
	while n > sum(a):
		a += [a[len(a) - 1] * 2 + i ** 2]
		i *= 2
	print(len(a))


from collections import Counter, defaultdict
from sys import stdin, stdout
input = stdin.readline
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
for _ in range(I()):
	n = I()
	i = 1
	j = 0
	ans = 0
	while True:
		i *= 2
		j += i * (i - 1) // 2
		if j > n:
			print(ans)
			break
		ans += 1


def can(no, mid):
	for i in range(1, mid + 1):
		tmp_no = pow(2, i) - 1
		no -= tmp_no * (tmp_no + 1) // 2
	if no >= 0:
		return 1
	else:
		return 0
cas = int(input())
while cas:
	cas -= 1
	no = int(input())
	x = 1
	y = 100
	while x + 1 < y:
		mid = x + (y - x) // 2
		if can(no, mid):
			x = mid
		else:
			y = mid
	print(x)


for _ in range(int(input())):
	n = int(input())
	val = 1
	summ = 1
	count = 0
	cells = 1
	while n - cells >= 0:
		n -= cells
		count += 1
		summ += pow(2, val)
		cells = summ * (summ + 1) // 2
		val += 1
	print(count)


for _ in range(int(input())):
	x = int(input())
	sm = 0
	cnt = 0
	n = 2
	k = 1
	while True:
		a = (n - 1) * n // 2
		sm += a
		if sm > x:
			break
		else:
			cnt += 1
			n *= 2
	print(cnt)


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	x = int(input())
	(s, p) = (0, 0)
	while s <= x:
		t = 2 ** p
		s += 2 * t * t - t
		p += 1
	print(p - 1)


max_range = 101
lis_range = [1 for i in range(0, max_range)]
x = 2
for i in range(2, max_range - 1):
	lis_range[i] = 2 * lis_range[i - 1] + pow(2, x)
	x += 2
for i in range(2, max_range - 1):
	lis_range[i] += lis_range[i - 1]
for i in range(int(input())):
	x = int(input())
	for k in range(2, max_range):
		if x == lis_range[k]:
			print(k)
			break
		elif x < lis_range[k]:
			print(k - 1)
			break


from collections import Counter
from collections import OrderedDict
from collections import defaultdict

def SOCountR(mylist):
	return OrderedDict(sorted(Counter(mylist).items(), reverse=True))

def SOCount(mylist):
	return OrderedDict(sorted(Counter(mylist).items()))

def freq_count(mylist):
	return Counter(mylist)
t = int(input())
arr = [pow(2, i + 1) - 1 for i in range(60)]
for _ in range(t):
	n = int(input())
	ans = 0
	ind = 0
	while n - arr[ind] * (arr[ind] + 1) // 2 >= 0:
		n = n - arr[ind] * (arr[ind] + 1) // 2
		ans += 1
		ind += 1
	print(ans)


import sys
inp = sys.stdin.buffer.readline
inar = lambda : list(map(int, inp().split()))
inin = lambda : int(inp())
inst = lambda : inp().decode().rstrip('\n\r')
_T_ = inin()
for _t_ in range(_T_):
	n = inin()
	rem = n
	ans = 0
	i = 1
	prev = 0
	while rem > 0:
		if i * i + 2 * prev <= rem:
			rem -= i * i + 2 * prev
			ans += 1
			prev = i * i + 2 * prev
			i *= 2
		else:
			break
	print(ans)


n = 1
nn = 1
a = []
while nn <= 10 ** 19:
	a.append([n, nn])
	n = 2 * n + 1
	nn = n * (n + 1) // 2
test = int(input())
for t in range(0, test):
	x = int(input())
	c = 0
	i = 0
	while x - a[i][1] >= 0:
		c += 1
		x -= a[i][1]
		i += 1
	print(c)


import sys
import math
input = sys.stdin.readline
for _ in range(int(input())):
	cnt = 0
	n = int(input())
	i = 0
	while n >= 0:
		i += 1
		cnt = pow(2, i) - 1
		n -= cnt * (cnt + 1) // 2
	print(i - 1)


T = int(input())
maxv = 10 ** 18
for t in range(T):
	x = int(input())
	i = 0
	cnt = 0
	i = 1
	while True:
		req = (1 + i) * i // 2
		if x - req >= 0:
			x -= req
			cnt += 1
			i = i + 2 ** cnt
		else:
			break
	print(cnt)


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


def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
n = inp()
for i in range(n):
	x = inp()
	l = 0
	cells = 0
	cnt = 0
	while x >= 0:
		cells = (l + 1) * (l + 1) + 2 * cells
		l = 2 * l + 1
		x -= cells
		cnt += 1
	cnt -= 1
	print(cnt)


import math
for _ in range(int(input())):
	n = int(input())
	lengths = [1]
	total_area = 1
	lengths.append(2 * lengths[-1] + 1)
	add = lengths[-1] * (lengths[-1] + 1) // 2
	while total_area + add <= n:
		total_area += add
		lengths.append(2 * lengths[-1] + 1)
		add = lengths[-1] * (lengths[-1] + 1) // 2
	print(len(lengths) - 1)


import os
import sys
from io import BytesIO, IOBase
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')
dp = [1]
for i in range(1, 31):
	dp.append((2 ** i) ** 2 + dp[-1] * 2)
t = int(input())
for _ in range(t):
	n = int(input())
	count = 0
	i = 0
	while n > 0:
		n -= dp[i]
		count += 1
		i += 1
	if n < 0:
		count -= 1
	print(count)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	x = int(input())
	a = 0
	i = 1
	b = a * (a + 1) // 2
	while b <= x:
		a = 2 * a + 1
		b += a * (a + 1) // 2
		i += 1
	print(i - 2)


t = int(input())
K = []
p = 1
total = 0
while True:
	if p > 10 ** 20:
		break
	total += p
	K.append(total)
	p *= 2
T = []
for i in range(len(K)):
	T.append((1 + K[i]) * K[i] // 2)
Ans = []
for i in range(t):
	A = int(input())
	c = 0
	j = 0
	while True:
		if A - T[j] < 0:
			break
		A -= T[j]
		j += 1
		c += 1
	Ans.append(c)
for i in range(t):
	print(Ans[i])


from bisect import bisect_left
import os
import sys
from io import BytesIO, IOBase
from collections import Counter, defaultdict
from collections import deque
from functools import cmp_to_key
import math
import heapq
import re

def sin():
	return input()

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

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	s = set()
	for p in range(2, n + 1):
		if prime[p]:
			s.add(p)
	return s

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def main():
	for _ in range(iin()):
		x = iin()
		flag = 1
		ans = 0
		p = 1
		while flag:
			j = p * (p + 1) // 2
			if x >= j:
				ans += 1
				x -= j
			else:
				break
			p = p * 2 + 1
		print(ans)
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')
if os.getcwd() == 'D:\\code':
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import os, sys
from io import BytesIO, IOBase

def main():
	for i in range(int(input())):
		n = int(input())
		x = [1, 6, 28, 120, 496, 2016, 8128, 32640, 130816, 523776, 2096128, 8386560, 33550336, 134209536, 536854528, 2147450880, 8589869056, 34359607296, 137438691328, 549755289600, 2199022206976, 8796090925056, 35184367894528, 140737479966720, 562949936644096, 2251799780130816, 9007199187632128, 36028796884746240, 144115187807420416, 576460751766552576]
		for j in range(1, len(x)):
			x[j] = x[j] + x[j - 1]
		an = 1
		for j in range(len(x)):
			if n < x[j]:
				print(j)
				an = -1
				break
		if an == 1:
			print(30)
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())
while t != 0:
	t -= 1
	res = 0
	n = int(input())
	for i in range(1, 64, 1):
		j = (1 << i) - 1
		if n >= int(j * (j + 1) / 2):
			n -= int(j * (j + 1) / 2)
			res += 1
	print(res)


for _ in range(int(input())):
	n = int(input())
	i = 1
	while True:
		x = pow(2, i - 1) * (pow(2, i) - 1)
		if n < x:
			break
		n -= x
		i += 1
	print(i - 1)


import math
nV = 4
INF = 999

def floyd_warshall(G):
	distance = list(map(lambda i: list(map(lambda j: j, i)), G))
	for k in range(nV):
		for i in range(nV):
			for j in range(nV):
				distance[i][j] = min(distance[i][j], distance[i][k] + distance[k][j])
	print_solution(distance)
from collections import defaultdict

def print_solution(distance):
	for i in range(nV):
		for j in range(nV):
			if distance[i][j] == INF:
				print('INF', end=' ')
			else:
				print(distance[i][j], end='  ')
		print(' ')
tt = int(input())
for _ in range(tt):
	n = int(input())
	c = 0
	t = 0
	j = 1
	while j <= n:
		temp = (2 ** j - 1) * 2 ** j // 2
		if n < t + temp:
			break
		t += temp
		c += 1
		j += 1
	print(c)


from decimal import Decimal
t = int(input())
for test in range(t):
	x = int(input())
	num = Decimal(1)
	a = Decimal(1)
	idx = Decimal(1)
	res = Decimal(0)
	while x >= a:
		res += 1
		x -= a
		idx = 2 * idx
		num = idx + num
		a = 2 * a + ((num + Decimal(1)) / Decimal(2)) ** 2
	print(res)


def stairs(n):
	if n == 1:
		return 1
	k = n
	temp = 0
	cnt = 0
	p = 0
	i = 1
	while n >= 0:
		temp = i * (i + 1) // 2
		n -= temp
		if n >= 0:
			cnt += 1
			p += 1
			i += 2 ** p
		else:
			break
	return cnt
t = int(input())
for i in range(t):
	print(stairs(int(input())))


from os import path
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input().rstrip()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('a')

def solve():
	a = [1, 3, 7, 15]
	while 1:
		x = a[-1]
		s = x * (x + 1) // 2
		if s > 1e+18:
			break
		a.append(2 * a[-1] + 1)
	for _ in range(ii()):
		n = ii()
		cnt = 0
		while n:
			x = a[cnt] * (a[cnt] + 1) // 2
			if n < x:
				break
			n -= x
			cnt += 1
		print(cnt)
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	input = sys.stdin.readline
solve()


from sys import stdin, stdout
from bisect import bisect_left
x = 2
cnt = 1
req = [1]
while x <= int(1e+18 + 1):
	x <<= 1
	t = x * (x - 1) // 2
	req.append(t)
test = int(stdin.readline())
for _ in range(test):
	n = int(stdin.readline())
	sm = 0
	i = 0
	while True:
		sm += req[i]
		if sm > n:
			ans = i
			break
		i += 1
	print(ans)


import sys
input = sys.stdin.readline
from itertools import accumulate
import bisect
LIST = [1]
for i in range(100):
	LIST.append(LIST[-1] * 2 + 1)
LIST2 = [l * (l + 1) // 2 for l in LIST]
S = list(accumulate(LIST2))
t = int(input())
for tests in range(t):
	x = int(input())
	print(bisect.bisect_right(S, x))


import bisect
t = int(input())
s = [0] * 40
for i in range(1, 40):
	s[i] = (2 ** (i - 1)) ** 2 + s[i - 1] * 2
ss = [0] * 41
for i in range(1, 40):
	ss[i] = ss[i - 1] + s[i]
for i in range(t):
	x = int(input())
	ans = bisect.bisect_right(ss, x) - 1
	print(ans)


t = int(input())
while t != 0:
	n = int(input())
	s = 0
	i = 0
	list1 = []
	count = 0
	while s < n:
		p = pow(2, i)
		if len(list1) == 0:
			list1.append(1)
			count += 1
			s = 1
		else:
			list1[-1] = list1[-1] + p
			s += list1[-1] * (list1[-1] + 1) // 2
			if s <= n:
				count += 1
			else:
				break
		i += 1
	print(count)
	t -= 1


ts = int(input())
l = [1]
for i in range(2, 32):
	l.append(2 ** i - 1)

def nsum(n):
	return n * (n + 1) // 2
for t in range(ts):
	x = int(input())
	i = 0
	while x > 0:
		if x - nsum(l[i]) >= 0:
			x -= nsum(l[i])
			i += 1
		else:
			break
	print(i)


for t in range(int(input())):
	x = int(input())
	n = 0
	ans = 0
	p = 1
	for i in range(1, 100):
		n = n * 2 + p * p
		x -= n
		p *= 2
		if x < 0:
			break
		ans += 1
	print(ans)


checker = [(2 ** n - 1) * (2 ** n - 1 + 1) // 2 for n in range(1000)]
for _ in range(int(input())):
	N = int(input())
	counter = 0
	for i in range(1000):
		N -= checker[i]
		if N < 0:
			print(counter - 1)
			break
		if N == 0:
			print(counter)
			break
		counter += 1


nice = [1]
while nice[-1] <= 10 ** 18:
	nice.append((nice[-1] << 1) + 1)
for i in range(len(nice)):
	nice[i] = nice[i] * (nice[i] + 1) // 2
t = int(input())
for _ in range(t):
	x = int(input())
	i = 0
	num = 0
	while x > 0 and i < len(nice):
		if x >= nice[i]:
			x -= nice[i]
			num += 1
		i += 1
	print(num)


import sys, os, io
I = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
N = int(1e+18)
l = []
n = 1
while True:
	x = n * (n + 1) // 2
	if x <= N:
		l.append(x)
	else:
		break
	n += n + 1
l.append(N + N)
for i in range(1, len(l)):
	l[i] += l[i - 1]
for tc in range(1, 1 + int(I())):
	x = int(I())
	for i in range(len(l)):
		if l[i] > x:
			print(i)
			break


from math import *
from cmath import *
from decimal import *
from fractions import *
t = int(input())
for _ in range(t):
	n = int(input())
	(s, k) = (0, 0)
	while s < n:
		k += 1
		s += (1 << k - 1) * ((1 << k) - 1)
	if s > n:
		k -= 1
	print(k)


import sys
from collections import deque
from math import ceil, sqrt, gcd, factorial, log
from bisect import bisect_right, bisect_left
mod = 1000000007
INF = 10 ** 18
NINF = -INF

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input(), split()))

def modi(x):
	return pow(x, mod - 2, mod)

def lcm(x, y):
	return x * y // gcd(x, y)

def write(l):
	for i in l:
		print(i, end=' ')
	print()

def fun(x):
	return x * (x - 1) // 2
for _ in range(int(input())):
	x = int(input())
	i = 1
	ans = 0
	while fun(2 ** i) <= x:
		ans += 1
		x -= fun(2 ** i)
		i += 1
	print(ans)


import sys, bisect, math
mv = 61
A = []
for i in range(1, mv + 1):
	val = int(math.pow(2, i)) - 1
	A.append(val * (val + 1) // 2)
T = int(input())
for _ in range(T):
	N = int(input())
	ans = 0
	v = 0
	for i in A:
		v = v + i
		if v > N:
			break
		ans = ans + 1
	print(ans)


ans = [2 ** i - 1 for i in range(1, 1000)]
ans = [tmp * (tmp + 1) // 2 for tmp in ans]
t = int(input())
for _ in range(t):
	n = int(input())
	cnt = 0
	val = 0
	for i in range(100):
		if val + ans[i] <= n:
			cnt += 1
			val += ans[i]
		else:
			break
	print(cnt)


import sys, os.path
from collections import *
from copy import *
import math
mod = 10 ** 9 + 7
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
for t in range(int(input())):
	n = int(input())
	t = 2
	ans = 0
	while n >= 0:
		if n >= t * (t - 1) // 2:
			n -= t * (t - 1) // 2
			t *= 2
			ans += 1
		else:
			break
	print(ans)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	power = 0
	used = 0
	x = 0
	ans = 0
	while used + (2 ** power + x) * (2 ** power + 1 + x) // 2 <= n:
		ans += 1
		used += (2 ** power + x) * (2 ** power + 1 + x) // 2
		x += 2 ** power
		power += 1
	print(ans)


p = int(input())
for _ in range(p):
	n = int(input())
	sum = 0
	k = 0
	if 1 == 3:
		print("Paran's Code")
	for j in range(31):
		sum = sum + 2 ** j
		if sum * (sum + 1) // 2 + k == n:
			print(j + 1)
			break
		elif sum * (sum + 1) // 2 + k > n:
			print(j)
			break
		else:
			k = k + sum * (sum + 1) // 2


n = int(input())
mas = [1]
for i in range(n):
	x = int(input())
	summ = 0
	k = 0
	while summ <= x:
		if len(mas) <= k:
			mas.append(2 ** (2 * len(mas)) + mas[-1] * 2)
		summ += mas[k]
		k += 1
	print(k - 1)


import sys

def squares(n):
	return n * (n + 1) // 2

def main():
	t = Iint()
	for _ in range(t):
		x = Iint()
		ans = 0
		s = 1
		while x - squares(s) >= 0:
			x -= squares(s)
			s = 2 * s + 1
			ans += 1
		print(ans)
en = enumerate
FIO = 10

def debug(*args, c=6):
	pass
	print('\x1b[3{}m'.format(c), *args, '\x1b[0m', file=sys.stderr)
BUFSIZE = 8 * 1024

def Istr():
	return input()

def Iint():
	return int(input())

def Ilist():
	return list(map(int, input().split()))

def Imap():
	return map(int, input().split())

def Plist(li, s=' '):
	print(s.join(map(str, li)))
if not FIO:
	if __name__ == '__main__':
		main()
		exit()
else:
	from io import BytesIO, IOBase
	import os

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))

def input():
	return sys.stdin.readline().rstrip('\r\n')
main()


def calculate(n):
	if n == 1:
		return 1
	return 1 + 2 * calculate(n // 2)

def makeList(upto):
	a = [1]
	n = 2
	while a[-1] < upto:
		s = 1 + 2 * a[n // 2 - 1]
		a.append(s)
		n += 1
	return a

def aritmetic(n):
	return n * (n + 1) // 2

def finalStuff(blocks):
	n = 1
	stairs = 0
	arit = aritmetic(n)
	while blocks >= arit:
		blocks -= arit
		stairs += 1
		n = 2 * n + 1
		arit = aritmetic(n)
	return stairs

def solve():
	t = int(input())
	for _ in range(t):
		blocks = int(input())
		print(finalStuff(blocks))
solve()


q = int(input())
for _ in range(q):
	n = int(input())
	wyn = 0
	pot = 1
	total = 1
	while total <= n:
		wyn += 1
		pot += 1
		total += (2 ** pot - 1) * 2 ** pot // 2
	print(wyn)


case = int(input())
for caseNum in range(0, case):
	n = int(input())
	count = 0
	while n >= 0:
		count += 1
		minus = 0
		i = 2 * (count - 1)
		j = 0
		while i >= 0:
			minus += 2 ** i * 2 ** j
			i -= 2
			j += 1
		n -= minus
	count -= 1
	print(count)


t = int(input())

def nice(x):
	nxt = 1
	Count = 0
	while 2 * x - nxt * (nxt + 1) >= 0:
		x -= nxt * (nxt + 1) // 2
		Count += 1
		nxt = 2 * nxt + 1
	return Count
for i in range(t):
	x = int(input())
	print(nice(x))


import math
t = input()
for i in range(int(t)):
	x = int(input())
	sum = 0
	j = 1
	r = 0
	values = [0]
	while x > 0:
		w = 2 * j - 1
		sum = w * (w + 1) / 2
		r = int(sum)
		if x < r:
			break
		m = round(math.sqrt(sum / 2))
		sum = sum - m * m
		sum = sum / 2
		for k in range(len(values)):
			if sum == values[k]:
				values = [r] + values
				x = x - r
				break
		j = 2 * j
	print(len(values) - 1)


def blocks(n):
	h = 2 ** n - 1
	b = h * (h + 1) // 2
	return b
for t in range(int(input())):
	n = int(input())
	total = 0
	c = 1
	while n >= blocks(c):
		n = n - blocks(c)
		c += 1
		total += 1
	print(total)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	curr_tiles = 0
	curr_val = 1
	ans = 0
	while curr_tiles <= n:
		curr_tiles += curr_val * (curr_val + 1) // 2
		curr_val = 2 * curr_val + 1
		if curr_tiles <= n:
			ans += 1
	print(ans)


sizes = [2 ** i - 1 for i in range(1, 32)]
blocks = [a * (a + 1) // 2 for a in sizes]
for _ in range(int(input())):
	x = int(input())
	i = 0
	while x >= blocks[i]:
		x -= blocks[i]
		i += 1
	print(i)


import sys
from sys import stdin
import math

def iinput():
	return int(input())

def minput():
	return map(int, input().split())

def linput():
	return list(map(int, input().split()))

def fiinput():
	return int(stdin.readline())

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

def flinput():
	return list(map(int, stdin.readline().strip().split()))
for _ in range(iinput()):
	n = iinput()
	i = 1
	s = 0
	c = 0
	while s < n:
		ii = (1 << i) - 1
		ss = ii * (ii + 1) // 2
		i += 1
		if s + ss <= n:
			s = s + ss
			c += 1
		else:
			break
	print(c)


t = int(input())
for tt in range(t):
	n = int(input())
	z = 0
	i = 1
	while True:
		if n >= i * (2 * i - 1):
			n -= i * (2 * i - 1)
			z += 1
			i *= 2
		else:
			break
	print(z)


def solve(x):
	remaining = x
	res = 0
	currentNiceStairs = 1
	while remaining > 0:
		consumed = currentNiceStairs * (currentNiceStairs + 1) // 2
		remaining -= consumed
		if remaining < 0:
			return res
		res += 1
		currentNiceStairs = 2 * currentNiceStairs + 1
	return res
t = int(input())
for _ in range(t):
	x = int(input())
	print(solve(x))


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
import math

def power(x, n):
	res = 1
	if n == 0:
		return 1
	while n > 0:
		if n & 1:
			res *= x
			n -= 1
		else:
			x *= x
			n = n // 2
	return res

def fun(n):
	return n * (n + 1) // 2
t = inp()
while t > 0:
	x = inp()
	cnt = 0
	for k in range(1, 61):
		dep = power(2, k) - 1
		if fun(dep) <= x:
			x -= fun(dep)
			cnt += 1
		else:
			break
	print(cnt)
	t -= 1


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil, pi, sin, cos, acos, atan
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = ip()
for _ in range(t):
	n = ip()
	if n == 1:
		ans = 1
	else:
		ans = 0
		cur = 0
		ct = 0
		p = 0
		while True:
			ct += pow(2, p)
			cur += ct * (ct + 1) // 2
			if cur > n:
				break
			ans += 1
			p += 1
	out(ans)


def get_int():
	return int(input())
for t in range(0, get_int()):
	x = get_int()
	current_stair_size = 1
	number = 0
	while x > 0:
		n = current_stair_size
		cells = (n * n + n) // 2
		x -= cells
		if x >= 0:
			number += 1
		current_stair_size = current_stair_size * 2 + 1
	print(number)


game = int(input())
for k in range(game):
	x = int(input())
	s = 1
	stairs = 1
	value = 0
	b = x
	while s <= b:
		prev = s
		s = 2 * s + (stairs + 1) ** 2
		stairs = 2 * stairs + 1
		value += 1
		b = b - prev
	print(value)


l = []
for i in range(1, 32):
	k = 2 ** i
	k = k - 1
	k = k * (k + 1) // 2
	l.append(k)
for i in range(1, len(l)):
	l[i] = l[i] + l[i - 1]
t = int(input())
while t > 0:
	n = int(input())
	for i in range(len(l)):
		if n < l[i]:
			print(i)
			break
	t -= 1


t = int(input())
while t:
	n = int(input())
	(c, tt, j) = (0, 0, 1)
	while j <= n:
		temp = pow(2, j) - 1
		temp *= pow(2, j) // 2
		if n < tt + temp:
			break
		tt += temp
		c += 1
		j += 1
	print(c)
	t -= 1


t = int(input())
while t > 0:
	t -= 1
	x = int(input())
	arr = [1] * 61
	for i in range(1, 61):
		arr[i] = arr[i - 1] + 2 ** i
	arr2 = [0] * 61
	arr2[0] = 1
	for i in range(1, 61):
		arr2[i] = arr2[i - 1] + arr[i] * (arr[i] + 1) // 2
	count = 0
	index = 0
	while index < 61 and arr2[index] <= x:
		index += 1
		count += 1
	print(count)


def get_stairs_block(n):
	return int(n * (n + 1) / 2)

def get_nice_stairs_height(n):
	stairs = [1]
	expo = 2
	while stairs[-1] <= n:
		stairs.append(stairs[-1] + expo)
		expo = expo * 2
	return {h: get_stairs_block(h) for h in stairs}
t = int(input())
for _ in range(t):
	x = int(input())
	nice_stairs = get_nice_stairs_height(10 ** 18)
	c = 0
	for (k, v) in nice_stairs.items():
		if v > x:
			break
		c += 1
		x -= v
	print(c)


t = int(input())
while t > 0:
	n = int(input())
	(st, s, j, i) = (0, 0, 1, 1)
	s = i * (i + 1) // 2
	while s <= n:
		st += 1
		n -= s
		j += 1
		i = pow(2, j) - 1
		s = i * (i + 1) // 2
	print(st)
	t -= 1


import math

def solve(n):
	k = int(math.log(int((-1 + math.sqrt(1 + 8 * n)) / 2) + 1, 2))
	l = 1
	Sum = 0
	while l <= k:
		Sum += 2 ** (l - 1) * (2 ** l - 1)
		if Sum > n:
			break
		l += 1
	return l - 1
t = int(input())
ans = []
for i in range(t):
	n = int(input())
	ans.append(solve(n))
for test in ans:
	print(test)


good = [1]
while good[-1] < 10 ** 18:
	good.append(good[-1] * 2 + 1)

def solve():
	n = int(input())
	res = 0
	for i in good:
		if i * (i + 1) // 2 <= n:
			res += 1
			n -= i * (i + 1) // 2
	print(res)
for i in range(int(input())):
	solve()


ans = [1]
op = 2
for i in range(0, 10 ** 18):
	op = op * 2
	ans.append(op - 1)
	if op > 10 ** 18:
		break
t = int(input())
while t != 0:
	t -= 1
	x = int(input())
	su = 0
	c = 0
	for i in ans:
		su = su + i * (i + 1) // 2
		if su <= x:
			c = c + 1
		else:
			break
	print(c)


tc = int(input())
for i in range(tc):
	n = int(input())
	h = 100
	s = 0
	i = 0
	ans = 0
	t = 0
	while i < h:
		t += 1 << i
		s += t * (t + 1) // 2
		i += 1
		if s <= n:
			ans += 1
		else:
			break
	print(ans)


from sys import stdin, stdout
import math
import heapq
import collections
input = stdin.readline

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputstrings():
	return [x for x in input().split()]

def inputstringnum():
	return [ord(x) - ord('0') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	x = inputnum()
	ans = 0
	cur = 1
	n = 2
	while x >= cur * (cur + 1) // 2:
		x -= cur * (cur + 1) // 2
		cur += n
		n *= 2
		ans += 1
	print(ans)


max = 31
l = [1, 6, 28]
j = 1
for i in range(3, max):
	x = l[i - 1] - pow(2, i - 1)
	for j in range((i - 1) * 2 + 1, 2 * i + 1):
		x += pow(2, j)
	l.append(x)
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(1)
		continue
	c = 0
	t = 0
	i = 0
	while t <= n:
		t += l[i]
		i += 1
	print(i - 1)


def solution(l):
	arr = [1]
	i = 1
	while arr[-1] <= l:
		p = 2 ** i
		i += 1
		arr.append(arr[-1] * 2 + p * p)
	i = 0
	for x in arr:
		if l >= x:
			i += 1
			l -= x
		else:
			break
	return i
n = int(input())
for i in range(n):
	l = int(input())
	print(solution(l))


t = int(input())
for _ in range(t):
	n = int(input())
	z = []
	i = 1
	k = 1
	while i < 10 ** 18:
		z.append(i)
		k += 1
		i = 2 ** k - 1
	x = 0
	i = 0
	ans = 0
	while x < n:
		if x + z[i] * (z[i] + 1) // 2 <= n:
			x += z[i] * (z[i] + 1) // 2
			i += 1
			ans += 1
		else:
			break
	print(ans)


import math
t = int(input())
while t:
	x = int(input())
	cnt = 0
	i = 1
	while True:
		if i * (i + 1) // 2 <= x:
			cnt += 1
		else:
			break
		x -= i * (i + 1) // 2
		i = i * 2 + 1
	print(cnt)
	t -= 1


from sys import stdout, stdin
(_input, _print) = (stdin.readline, stdout.write)
(_range, _int) = (range, int)

def solution():
	arr = [0] * 100
	for i in _range(100):
		arr[i] = (2 ** i) ** 2
	cube = [1]
	i = 1
	while cube[-1] < 10 ** 18:
		cube.append(cube[-1] * 2 + arr[i])
		i += 1
	for _ in _range(_int(_input())):
		n = _int(_input())
		index = 1
		ans = 0
		while n > cube[index]:
			ans += 1
			n -= cube[index]
			index += 1
		print(ans + 1)
solution()


for _ in range(int(input())):
	x = int(input())
	s = 0
	for i in range(1, 32):
		s = s + (2 ** i - 1) * 2 ** (i - 1)
		ans = i - 1
		if s > x:
			break
	print(ans)


import sys
input = sys.stdin.readline

def triangle_num(n):
	return n * (n + 1) // 2

def solve(x):
	count = 0
	longest = 1
	while triangle_num(longest) <= x:
		count += 1
		x -= triangle_num(longest)
		longest = 2 * longest + 1
	return count
t = int(input())
for _ in range(t):
	x = int(input())
	print(solve(x))


import bisect
t = int(input())
interest_n = [1 for _ in range(31)]
sum_arr = [1 for _ in range(31)]
for i in range(1, 31):
	interest_n[i] = interest_n[i - 1] * 2 + 1
for i in range(1, len(sum_arr)):
	sum_arr[i] = sum_arr[i - 1] + (interest_n[i] + 1) * interest_n[i] // 2
for _ in range(t):
	n = int(input())
	print(bisect.bisect(sum_arr, n))


from collections import *
tri = []
(c, x) = (1, 1)
while x < 10 ** 18:
	tri.append(x)
	c = 2 * c + 1
	x = int((1 + c) * c / 2)
for i in range(int(input())):
	n = int(input())
	print(len([x for (i, x) in enumerate(tri) if sum(tri[:i + 1]) <= n]))


import math
sum = 1
temp = [1]
for i in range(1, 31):
	sum += math.pow(2, i)
	temp.append(sum)
for z in range(int(input())):
	x = int(input())
	cnt = 0
	i = 0
	while x > 0:
		if x >= int(temp[i] * (temp[i] + 1) / 2):
			cnt += 1
		x -= int(temp[i] * (temp[i] + 1) / 2)
		i += 1
	print(cnt)


def solve():
	x = int(input())
	if x >= 1 and x < 7:
		print(1)
		return
	if x >= 7 and x < 35:
		print(2)
		return
	ans = 2
	(a, b) = (1, 7)
	c = 6 * b - 8 * a + 1
	while c <= x:
		ans += 1
		(a, b) = (b, c)
		c = 6 * b - 8 * a + 1
	print(ans)
for _ in range(int(input())):
	solve()


from functools import lru_cache
from sys import stdin, stdout
import sys
from math import *
for __ in range(int(input())):
	n = int(input())
	a = 1
	ans = 0
	temp = 0
	while temp < n:
		temp += (2 ** a - 1) * 2 ** a // 2
		if temp <= n:
			ans += 1
		a += 1
	print(ans)


for _ in range(int(input())):
	x = int(input())
	ans = 0
	for i in range(1, 31):
		num = ((1 << 2 * i + 1) - 3 * (1 << i) + 1) // 3
		if x - num >= 0:
			ans = i
	print(ans)


from sys import stdin

def iinput():
	return int(stdin.readline())

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

def linput():
	return list(map(int, stdin.readline().split()))
t = iinput()
while t:
	t -= 1
	x = iinput()
	cell = 0
	staircase = 1
	to_cells = 1
	while True:
		staircase += 1
		temp = 2 ** staircase - 1
		re_cells = temp * (temp + 1) // 2
		to_cells += re_cells
		if to_cells > x:
			staircase -= 1
			break
	print(staircase)


import sys
import math
from collections import defaultdict, Counter
input = sys.stdin.readline

def print(x):
	sys.stdout.write(str(x) + '\n')
t = int(input())
for i in range(t):
	x = int(input())
	ans = 0
	for i in range(1, 31):
		cur = pow(2, i) - 1
		cur1 = cur * (cur + 1) // 2
		if x >= cur1:
			ans += 1
			x -= cur1
		else:
			break
	print(ans)


for _ in range(int(input())):
	x = int(input())
	ans = {1: 1}
	n = 1
	i = 1
	while True:
		k = ans[n]
		n *= 2
		ans[n] = k * 2 + n ** 2
		if ans[n] > 10 ** 18:
			break
	a = 0
	for i in ans:
		if x - ans[i] >= 0:
			x -= ans[i]
			a += 1
		else:
			break
	print(a)


import sys
import math
import collections
import bisect
import itertools
import decimal
import copy
import heapq
INF = 10 ** 20
MOD = 998244353
ni = lambda : int(sys.stdin.readline().rstrip())
ns = lambda : map(int, sys.stdin.readline().rstrip().split())
na = lambda : list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda : list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))
flush = lambda : sys.stdout.flush()

def main():
	t = ni()
	for _ in range(t):
		x = ni()
		items = [1]
		for i in range(1, x):
			p = pow(2, i)
			tmp = 2 * p ** 2 - p
			if tmp > x:
				break
			else:
				items.append(tmp)
		ans = 0
		total = 0
		for it in items:
			total += it
			if total <= x:
				ans += 1
			else:
				break
		print(ans)
main()


def inp():
	return int(input())

def linp():
	return list(map(int, input().split()))

def minp():
	return map(int, input().split())
for _ in range(inp()):
	x = inp()
	su = 0
	c = 0
	for i in range(1, x + 1):
		s = pow(2, i) - 1
		s2 = (pow(s, 2) + s) // 2
		if su + s2 > x:
			break
		else:
			su += s2
			c += 1
	print(c)


from math import ceil
t = int(input())
for i in range(t):
	x = int(input())
	count = 0
	i = 1
	while x > 0:
		y = 2 ** i - 1
		b = y * (y + 1) // 2
		if b > x:
			break
		count += 1
		x -= b
		i += 1
	print(count)


def solve(n):
	if n <= 6:
		return 1
	i = 1
	s = 1
	while s <= n:
		i += 1
		p = 1 << i
		s = (p - 1) * ((p << 1) - 1) // 3
	return i - 1
t = int(input())
for i in range(t):
	n = int(input())
	print(solve(n))


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	if n == 1:
		print(1)
		continue
	i = 0
	cnt = -1
	while n >= 0:
		i += 1
		cnt += 1
		n2 = pow(2, i) - 1
		n1 = (n2 * n2 + n2) // 2
		n -= n1
	print(cnt)


from bisect import bisect_right
d = 1
co = 0
cos = []
while d <= 32:
	tmp = 2 ** d - 1
	tmp2 = (tmp + 1) * tmp // 2
	co += tmp2
	cos.append(co)
	d += 1
for _ in range(int(input())):
	n = int(input())
	idx = bisect_right(cos, n)
	print(idx)


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	dp = []
	for i in range(1, 100):
		yy = pow(2, i)
		dp.append(yy * (yy - 1) // 2)
	for _ in range(t):
		X = int(input())
		cnt = 0
		total = 0
		for i in range(100):
			total += dp[i]
			if total > X:
				print(i)
				break
main()


def ceil(a, b):
	return (a + b - 1) // b

def allBlocks(lim=10 ** 18):
	blocks = []
	i = 0
	res = 1
	while res <= lim:
		n = i + res * res
		blocks += [n]
		lim -= n
		i = n * 2
		res *= 2
	resBlocks = [0]
	for block in blocks:
		resBlocks += [resBlocks[-1] + block]
	return resBlocks
stairs = allBlocks()
for _ in range(int(input().strip())):
	N = int(input())
	ans = 0
	for stair in stairs:
		if stair <= N:
			ans += 1
		else:
			break
	print(ans - 1)


from __future__ import division, print_function
from sys import stdin, stdout
import bisect
import math
import heapq
i_m = 9223372036854775807

def inin():
	return int(input())

def stin():
	return input()

def spin():
	return map(int, stin().split())

def lin():
	return list(map(int, stin().split()))

def matrix(n):
	return [list(map(int, input().split())) for i in range(n)]

def count2Dmatrix(i, list):
	return sum((c.count(i) for c in list))

def modinv(n, p):
	return pow(n, p - 2, p)

def GCD(x, y):
	x = abs(x)
	y = abs(y)
	if min(x, y) == 0:
		return max(x, y)
	while y:
		(x, y) = (y, x % y)
	return x

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l
prime = []

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j
for _ in range(inin()):
	n = inin()
	(i, count) = (1, 0)
	temp = 0
	while 1:
		temp = 2 ** i - 1
		if n - temp * 2 ** (i - 1) < 0:
			print(count)
			break
		else:
			n -= temp * 2 ** (i - 1)
			count += 1
		i += 1


import sys
import math as mt
import bisect
input = sys.stdin.readline
t = int(input())

def solve():
	i = 1
	suma = 1
	mul = 2
	ans = 0
	left = 0
	while suma + left <= n and i <= n:
		ans += 1
		i += mul
		left += suma
		suma = i * (i + 1) // 2
		mul *= 2
	return ans
for _ in range(t):
	n = int(input())
	print(solve())


import os
import sys
from io import BytesIO, IOBase
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')
from math import gcd, ceil

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
a = [1]
k = 3
for i in range(6969):
	a += [k * (k + 1) // 2]
	k = 2 * k + 1
for _ in range(int(input()) if True else 1):
	n = int(input())
	i = 0
	while n >= a[i]:
		n -= a[i]
		i += 1
	print(i)


t = int(input())
while t:
	t += -1
	n = int(input())
	(x, y, sm, ans) = (1, 1, 0, 0)
	while 1:
		sm += x * (x + 1) // 2
		if sm > n:
			break
		ans -= -1
		y -= -1
		x = 2 ** y - 1
	print(ans)


def mi():
	return map(int, input().split())
for _ in range(int(input())):
	n = int(input()) - 1
	times = 1
	out = 1
	while (2 ** (times + 1) - 1) * 2 ** times <= n:
		out += 1
		n -= (2 ** (times + 1) - 1) * 2 ** times
		times += 1
	print(out)


import sys, math
import io, os
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter

def data():
	return sys.stdin.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write(' '.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
from decimal import Decimal
mod = 998244353
INF = float('inf')
l = [1]
t = 1
s = [1]
for i in range(30):
	t *= 4
	l.append(2 * l[-1] + t)
	s.append(s[-1] + l[i + 1])
for t in range(int(data())):
	out(br(s, int(data())))


for h in range(int(input())):
	x = int(input())
	ans = 0
	s = 1
	num = 2 ** s - 1
	sumi = num * (num + 1) // 2
	while x >= sumi:
		ans += 1
		s += 1
		num = 2 ** s - 1
		x -= sumi
		sumi = num * (num + 1) // 2
	print(ans)


def arith(x) -> int:
	return x * (x + 1) // 2
t = int(input())
for i in range(t):
	x = int(input())
	count = 0
	summ = 0
	j = 1
	temp = arith(j)
	while summ + temp <= x:
		summ += temp
		j = j * 2 + 1
		temp = arith(j)
		count += 1
	print(count)


def solve(a):
	res = a * (a + 1) // 2
	return res
for _ in range(int(input())):
	n = int(input())
	x = 0
	to_add = 0
	c = 0
	real = 0
	while True:
		to_add += 1
		x = pow(2, to_add) - 1
		real += solve(x)
		if real <= n:
			c += 1
		else:
			break
	print(c)


n = int(input())
i = 0
while i < n:
	q = int(input())
	count = 0
	pred_kl = 0
	st = 0
	while q > 0:
		pred_kl = 2 * pred_kl + (st + 1) ** 2
		st = st * 2 + 1
		count += 1
		q -= pred_kl
	if q < 0:
		count -= 1
	print(count)
	i += 1


for _ in range(int(input())):
	s = int(input())
	c = 0
	i = 1
	while True:
		n = 2 ** i - 1
		if s >= n * (n + 1) // 2:
			c += 1
			s -= n * (n + 1) // 2
		else:
			break
		i += 1
	print(c)


import math

def fun(k):
	return (2 ** k - 1) * 2 ** (k - 1)
t = int(input())
for i in range(t):
	x = int(input())
	start = 1
	ans = 0
	while x > 0:
		x -= fun(start)
		if x >= 0:
			start += 1
			ans += 1
	print(ans)


t = int(input())
for _ in range(t):
	x = int(input())
	num = 0
	k = 0
	while True:
		k += 1
		num += 2 ** (k - 1) * (2 ** k - 1)
		if num > x:
			print(k - 1)
			break


(lambda s: ([s.append(s[-1] + (1 << (i << 1) - 1) - (1 << i - 1)) for i in range(1, 65)], [(lambda N, ss: print(max((i[0] for i in ss if i[1] <= N))))(int(input()), enumerate(s)) for t in range(int(input()))]))([0])


t = int(input())
for _ in range(t):
	x = int(input()) - 1
	p = 4
	c = 1
	while (p - 1) * p // 2 <= x:
		c += 1
		x -= (p - 1) * p // 2
		p *= 2
	print(c)


def solve():
	n = int(input())
	cur = 1
	cnt = 1
	sum = 1
	while True:
		cur *= 2
		cur += 1
		sum += cur * (cur + 1) // 2
		if sum > n:
			break
		cnt += 1
	print(cnt)
t = int(input())
for i in range(t):
	solve()


import sys
input = sys.stdin.readline

def f(x):
	return (x * (x + 1) * (2 * x + 1) // 6 + x * (x + 1) // 2) // 2

def g(x):
	R = 0
	for i in range(1, x + 1):
		y = 2 ** i - 1
		R += y * (y + 1) // 2
	return R

def bsearch(mn, mx, func):
	idx = (mx + mn) // 2
	while mx - mn > 1:
		if func(idx):
			(idx, mx) = ((idx + mn) // 2, idx)
			continue
		(idx, mn) = ((idx + mx) // 2, idx)
	return idx
(T,) = map(int, input().split())
for _ in range(T):
	(N,) = map(int, input().split())
	x = bsearch(0, 1000, lambda x: g(x) > N)
	print(x)


t = int(input())
for k in range(t):
	x = int(input())
	n = 1
	cubes = 1
	ans = 0
	while x - cubes >= 0:
		ans += 1
		x -= cubes
		cubes = (n + 1) * (n + 1) + 2 * cubes
		n = 2 * n + 1
	print(ans)