Factorials with an even number of trailing zeroes

No attempts yetTime limit1sMemory limit128 MB

Problem

The factorial of a positive integer nn is written n!n! and is defined like this.

n!=1×2×3×4××(n1)×nn! = 1 \times 2 \times 3 \times 4 \times \cdots \times (n-1) \times n

The value of 0!0! is taken to be 11. As nn grows, n!n! grows very quickly. Here are a few values.

  • 0!=10! = 1
  • 1!=11! = 1
  • 2!=22! = 2
  • 3!=63! = 6
  • 4!=244! = 24
  • 5!=1205! = 120
  • 10!=362880010! = 3628800
  • 14!=8717829120014! = 87178291200
  • 18!=640237370572800018! = 6402373705728000
  • 22!=112400072777760768000022! = 1124000727777607680000

For some nn the number of trailing zeroes of n!n! is odd. That happens for 5!5! and 18!18!. For other nn it is even, as with 0!0!, 10!10! and 22!22!.

Given nn, count how many of 0!,1!,2!,3!,,(n1)!,n!0!, 1!, 2!, 3!, \ldots, (n-1)!, n! have an even number of trailing zeroes.

Input

Standard input holds one query per line, at most 10001000 of them. Each query is a single integer nn (0n10180 \le n \le 10^{18}).

The last line holds 1-1. That line is not a query, it only marks the end of the input.

Output

Print one line per query. The line holds how many of 0!,1!,2!,3!,,n!0!, 1!, 2!, 3!, \ldots, n! have an even number of trailing zeroes.

Print nothing for the 1-1 that ends the input.