https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1130
#include<bits/stdc++.h>
using namespace std;
const double pi = 3.14159265358979, de = log10(2.71828182845905);
int main()
{
int t;
cin >> t;
while (t--){
int n;
cin >> n;
cout << (long long)(0.5 * log10(2.0 * pi * n) + n * (log10(n) - de)) + 1 << endl;
}
return 0;
}