Account
GitHubFeedback
Drafts and results saved on this device
Submit on CSES.fi
CSES Problemset/Introductory Problems

Trailing Zeros

#1618
Ask AI

Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.

Open Claude Desktop

Time limit:1.00 s
Memory limit:512 MB
Unsolved
Download Tests (.zip)

Your task is to calculate the number of trailing zeros in the factorial n!n!.

For example, 20!=243290200817664000020!=2432902008176640000 and it has 44 trailing zeros.

Input

The only input line has an integer nn.

Output

Print the number of trailing zeros in n!n!.

Constraints
  • 1≤n≤1091 \le n \le 10^9
Sample Test Cases (1)
Example 1ID: sample-1
Input
20
Expected Output
4
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|1 line, 0 chars
Test Bench
Download .zip
Input (stdin)
20
Expected Output
4