Inverse factorial

Given a huge number that is some factorial n!, recover the integer n. The input can have up to a million digits.

Medium6MathNumber theoryBinary searchImplementationNo attempts yetTime limit2sMemory limit512 MB

Problem

Given a positive integer nn, computing the factorial n!n! is easy. This time the direction is reversed: you are given n!n! and have to recover nn.

Input

The first line contains n!n! for some natural number nn. The number of digits of n!n! is at most 10610^6. The input is always the factorial of some natural number, and nn is at least 1.

Output

Print nn on the first line.