LENGFACT - Factorial length

no tags 

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

hide comments
SangKuan: 2015-06-27 06:00:46

wtf...use log10 get wa,and use log,get ac.

Dushyant Singh: 2015-05-28 20:55:38

Normal length formula to get TLE. Stirling to get AC.

Akshit Johry: 2015-05-28 20:12:00

any other method other than kamenetsky ?

Lehar: 2015-03-26 07:34:43

Kamenetsky :D

Vaporeon: 2015-03-09 14:58:24

apply maths except for n==1||n==0 :D

swyam prakash singh: 2015-01-17 00:11:23

a good problem on concentration

amit kamboj: 2013-02-02 17:16:39

take care about n = 0 and n = 1


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

Problem's scores 1 vote

Concept difficulty
Concept difficulty 35%
Implementation difficulty
Implementation difficulty 10%
26 15