#include <cstdio>
#include <iostream>
#include <math.h>
using namespace std;
int main(){
	freopen("Weighing.in","r",stdin);
	long n,j=0,j1,j2,jl=0; long t;
	cin >>t;
	for (int i=0; i<t; i++){
		cin>>n;
		while (n-1) {n=floor((double)n/2);j++;}
		j1=floor(sqrt((double)n)); 
		//j2=floor(log10((double)n)/log10((double)2)); 
		//if ((j1<j2)&&(j1<j)) jl=j1; 
		//if ((j2<j1)&&(j2<j)) jl=j2; 
		//if ((j<j1)&&(j<j2)) jl=j;
		if (j<j1) jl=j; else jl=j1;
		cout<<jl<<"\n"; j=0;
	}

return 0;
}