#include<stdio.h>
#include<math.h>
#define PI 3.1415926535898
#define e 2.7182818284590
int main()
{
int t,n;
double ans;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
ans=log10(sqrt(2*PI*n))+n*log10(n/e);
printf("%.0lf\n",ceil(ans));
}
return 0;
}