Factorial Trailing Zeroes

Medium

Description

Given an integer n, return the number of trailing zeroes in n!. Trailing zeroes are created by factors of 10, which come from pairs of 2 and 5.

Examples

Input:n = 3
Output:0
Explanation:

3! = 6, no trailing zero.

Input:n = 5
Output:1
Explanation:

5! = 120, one trailing zero.

Input:n = 0
Output:0
Explanation:

0! = 1, no trailing zero.

Constraints

  • 0 ≤ n ≤ 10⁴

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!