IFACTO - Do you know Factorials


Factorial of a number N can be defined as: N! = 1 * 2 * 3 * 4 * ..... * (N-1) * N.
Also 0! = 1.

As this could be large number, So we don't want you to calculate it. Instead you are given factorial of a number and you have to predict the number.

Input

The first line of input contain n!.

Constraints

  • 2 ≤ n!
  • 1 ≤ d ≤ 106 (d is total number of digits in the n!)

Output

For each given n! print value of n.

Example

Input:
24

Output:
4
Input:
51090942171709440000

Output:
21
Input:
10888869450418352160768000000

Output:
27

hide comments
offamitkumar: 2020-06-17 19:56:19

Hey @Lakshman my solution with python3 got accepted.

[Lakshman]: 2020-06-17 16:08:05

I don't think time limit is justified for language like python. My O(log n) is getting TLE.

nadstratosfer: 2020-06-16 22:11:15

Same as FUNFACT, except poorly set (single case testfiles and unreasonable TL). Please delete.

---

I will repost any comment of mine as many times as it gets deleted thanks to Lazarus FF addon. Want a community where silencing people seems like a better idea, go to North Korea or one of the increasingly orwellian anglosaxon countries. Here, if there are issues a comment touches on, you're gonna have to resolve them.

Francky: 2020-06-16 21:42:30

@psetter : please don't hide comment of psolver.
Here, it is said that FUNFACT already exists, and this problem should be put in tutorial. I agree.
Please move to tutorial and stop hiding psolver comments.
=(Francky)=> Done. Thanks for your comprehension.

Last edit: 2020-06-17 10:26:35
nadstratosfer: 2020-06-16 16:12:37

Same as FUNFACT, except poorly set (single case testfiles and unreasonable TL). Please delete.


Added by:Amit
Date:2020-06-16
Time limit:0.100s-0.200s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All