Problems > Zeros at the End of N!

Zeros at the End of N!

Difficulty: 1300 2000 ms 128 MB

math

How many zeros does N! end with in decimal?

Input: one integer N.

Output: the number of trailing zeros of N!.

Constraints:

  • 0 ≤ N ≤ 1018

Sample Tests

Input 1
10
Output 1
2
Input 2
25
Output 2
6

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.