Submit solution

Points: 10
Time limit: 1.0s
Memory limit: 16M

Problem type
Allowed languages
Assembly, Brain****, C, C++, COBOL, Forth, Fortran, Java, Lua, Prolog, Text, Turing
ACSL Practice 2009

The factorial of a positive integer n, written as n!, is the product of the first n positive integers. That is,

\displaystyle n! = 1 \times 2 \times \dots \times n

Given a positive integer n, find the number of zeros in the decimal representation of n!. Of course, leading zeros should not be counted. (Note that decimal representation means base ten representation.)

Example 1. There are 7 zeros in the decimal representation of 20!.

\displaystyle 20! = 1 \times 2 \times \dots \times 20 = 2432902008176640000

Example 2. There are 2 zeros in the decimal representation of 7!.

\displaystyle 7! = 1 \times 2 \times 3 \times 4 \times 5 \times 6 \times 7 = 5040

Example 3. There is no zero in the decimal representation of 4!.

\displaystyle 4! = 1 \times 2 \times 3 \times 4 = 24

Input Specification

The input contains a single positive integer n \le 100.

Output Specification

The number of zeros in the decimal representation of n!.

Sample Input 1

20

Sample Output 1

7

Sample Input 2

7

Sample Output 2

2

Sample Input 3

4

Sample Output 3

0

Comments

There are no comments at the moment.