#include <iostream>
#include <cmath>
using namespace std;
int main(){
long long int cases,n,i;
double sum;
cin >> cases;
for(i=1;i<=cases;++i){
cin >> n;
if((n==1)||(n==0))
cout << "1" << endl;
else {
cout << int((log(2*M_PI*n)/2+n*(log(n)-log(M_E)))/log(10))+1 << endl;
}
}
return 0;
}
Any problem with the formula??