This page is still under construction.

Parts of this page are still being built. What you see may change.

Double Factorial

Time limit1sMemory limit128 MB

Summary
Count the trailing zeros of the product of the first n factorials, where n can reach 10^18.
Level

Medium7 of 10

Topics
Math, Binary search, Number theory
Solved
No attempts yet

Problem

For a positive integer nn, its factorial n!n! is the product of all integers from 11 to nn. Define the double factorial of nn as the product of the first nn factorials:

1!⋅2!⋅3!⋯n!1! \cdot 2! \cdot 3! \cdots n!

Given nn, determine the number of trailing zeros in the decimal representation of this double factorial.

Input

A single line contains one integer nn (1≤n≤10181 \le n \le 10^{18}).

Output

Print a single line with the number of trailing zeros of the double factorial of nn.

Hint

For n=11n = 11, the double factorial equals 265790267296391946810949632000000000265790267296391946810949632000000000, which has 99 trailing zeros.

Examples3

  1. Example 1

    Input
    11
    
    Expected output
    9
    
  2. Example 2

    Input
    1
    
    Expected output
    0
    
  3. Example 3

    Input
    5
    
    Expected output
    1