#K65232. Trailing Zeros in Factorial

    ID: 32152 Type: Default 1000ms 256MiB

Trailing Zeros in Factorial

Trailing Zeros in Factorial

Given a non-negative integer n, your task is to compute the number of trailing zeros in n! (n factorial). The trailing zeros are created by the factors 10 in the factorial. Since there are more factors of 2 than 5 in most factorials, the answer is determined by the number of times 5 is a factor in the numbers from 1 to n.

The mathematical formula is given by:

\[Z(n) = \sum_{i=1}^{\infty} \left\lfloor \frac{n}{5^i} \right\rfloor\]

where \(\left\lfloor x \right\rfloor\) denotes the floor function. The summation stops when \(5^i > n\).

inputFormat

The input consists of a single line containing a non-negative integer n (0 ≤ n ≤ 109).

outputFormat

Output a single integer representing the number of trailing zeros in n!.

## sample
5
1

</p>