#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
const double pi=acos(-1.0);
const double e=2.718281828459;
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
long long n;
scanf("%lld",&n);
printf("%lld\n",(long long)(0.5*log10(2*n*pi)+n*log10(n/e)+1));
}
}