#K82512. Trailing Zeros in Factorial

    ID: 35992 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).

Trailing zeros are produced by the factors of 10 in the number, and since 10 is (2 \times 5), the number of trailing zeros is determined by the number of times 5 is a factor in the numbers from 1 to (n).

The formula for the count is given by: $$T(n)=\sum_{k=1}^{\infty}\left\lfloor \frac{n}{5^k} \right\rfloor$$, where the sum continues until (5^k > n).

inputFormat

Input consists of a single non-negative integer (n) provided via standard input.

outputFormat

Output a single integer representing the number of trailing zeros in (n!) printed to the standard output.## sample

0
0