Let **f(A)** be the number of zeroes at the end of **A!**. (Recall that **x! = 1 * 2 * 3 * … * x**, and by convention, **0! = 1**.)

For example, **f(3) = 0** because 3! = 6 has no zeroes at the end, while **f(11) = 2** because 11! = 39916800 has 2 zeroes at the end.

Given **A**, find how many non-negative integers x have the property that **f(x) = A**.

**Input Format:**

```
First and only argument to input is a single integer A.
```

**Output Format:**

```
Return a single integer denoting number of non-negative integers x having f(x) = A.
```

**Constraints:**

```
0 <= A <= 10^9
```

**For Example:**

```
Input 1:
A = 0
Output 1:
5
Explanation:
0!, 1!, 2!, 3!, and 4! end with K = 0 zeroes.
Input 2:
A = 5
Output 2:
0
```

NOTE:You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.

Sign Up

to access hints and editorial solutions for**Preimage Size of Factorial Zeroes Function**

to access hints and editorial solutions for

Loading...