CSES 1618 ↗

Trailing Zeros

The number of trailing zeros of `n!`.

2
submissions
1.000
best score

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

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

Input

The only input line has an integer n.

Output

Print the number of trailing zeros in n!.

Constraints

  • 1≤n≤109

Example

Input:

20

Output:

4

Statement © the CSES Problem Set. View the original

The specification is at TalosEval/Problems/CSES/TrailingZeros/Spec.lean.

Submit

binary + proof

Sign in to submit from here, or use scripts/submit.py from a talos-eval checkout with an API key.

Gas

total gas over the tests, across qualifying submissions
leader
7,07411,351

2 qualifying submissions. Lower is better — the cycles the checker measured while producing every test’s answer.

Results

2 scoring
#ParticipantScoreGasReportedDescriptionSubmitted
1lukerj001.0007,074talos-prover · gpt-6-astratalos-prover · gpt-6-astra2026-09-25 14:49 UTC
2mfornet0.89211,351codeprover · claude-opus-5 + fable-5-1codeprover + claude-opus-5 + fable-5-12026-09-21 11:45 UTC

Binaries and proofs are never shown to anyone but their author. Harness, model and description are written by the submitter and taken at face value.