#include <math.h>
#define maxn 100001
const double e = 2.7182818284590452354, pi = 3.141592653589793239;
double biao[maxn];
using namespace std;
main()
{
int i;
biao[0]=0.0;
for(i=1;i<maxn;i++)
biao[i]=log10((double)i)+biao[i-1];
int n;
cin >>n;
while(n--)
{
int t;
double ans;
cin>>t;
if(t<maxn)
ans=biao[t];
else{
ans=log10(sqrt(2*pi*t))+t*log10(t/e);
}
cout<<(int)ans+1<<endl;
}
return 0;
}
#include<math.h>
#define PI 3.14159265
int main(){
int len,N;
int k;
scanf("%d",&k);
while(k--)
{
scanf("%d",&N);
if(N==1)
len=1;
else
len=(int)ceil((N*log(N)-N+log(2*N*PI)/2)/log(10));
}
return 0;
}