LENGFACT - Factorial length

Given integer n, print length of n! (which is factorial of n).

Input

The first line of the standard input contains one integer t (t < 10001) which is the number of test cases.

In each of the next t lines there is number n (0 <= n <= 5*10^9).

Output

For each test, print the length of n! (which is factorial of n).

Example

Input:
3
1
10
100

Output:
1
7
158

Added by:Piotr KÄ…kol
Date:2010-01-19
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:Copy of the problem: FACTLENG with different assessment

hide comments
2015-06-27 06:00:46 SangKuan
wtf...use log10 get wa,and use log,get ac.
2015-05-28 20:55:38 Dushyant Singh
Normal length formula to get TLE. Stirling to get AC.
2015-05-28 20:12:00 Akshit Johry
any other method other than kamenetsky ?
2015-03-26 07:34:43 Lehar
Kamenetsky :D
2015-03-09 14:58:24 Vaporeon
apply maths except for n==1||n==0 :D
2015-01-17 00:11:23 swyam prakash singh
a good problem on concentration
2013-02-02 17:16:39 amit kamboj
take care about n = 0 and n = 1
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.