PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#SP0000202. Số chữ số 0 cuối của giai thừa (Factorial)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Số chữ số 0 cuối của giai thừa (Factorial)

Factorial

Source: SPOJ

Version: Phuoc Hung OJ Extended

Problem Statement

For a positive integer nn, its factorial is n!=1⋅2⋯nn!=1\cdot2\cdots n. In decimal notation, the factorial may end with a sequence of zero digits. For example, 5!=1205!=120 has one trailing zero and 10!=362880010!=3628800 has two.

Given nn, determine the number of consecutive zero digits at the end of n!n!. You do not need to output the factorial itself.

Input

The only line contains the integer nn.

Output

Print one integer: the number of trailing zeros of n!n!.

Subtasks

  • Subtask 1 (20 points): 1≤n≤1001\le n\le 100.
  • Subtask 2 (30 points): 1≤n≤1051\le n\le 10^5.
  • Subtask 3 (50 points): 1≤n≤1091\le n\le 10^9.

Examples

Input

100

Output

24

Explanation

For n=100n=100, multiples of 55 contribute ⌊100/5⌋=20\lfloor100/5\rfloor=20 factors of 55. Multiples of 2525 contribute another 44 factors. There are no multiples of 125125. Thus there are 20+4=2420+4=24 factors of 55, and there are more factors of 22, so the answer is 2424.