#include <cstdio>
#include <iostream>
#include <math.h>
using namespace std;
int main(){
	freopen("Weighing.in","r",stdin);
	long n,j=0,j1,j2,jl; 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>j3)) jl=j1; if ((j2>j1)&&(j2>j)) jl=j2; if ((j>j1)&&(j>j2)) jl=j;
		cout<<jl<<"\n"; j=0;
	}

return 0;
}