Problem:
 Score : 500 points    Problem Statement For an integer n not less than 0 , let us define f(n) as follows:   f(n) = 1 (if n < 2 )  f(n) = n f(n-2) (if n \geq 2 )   Given is an integer N . Find the number of trailing zeros in the decimal notation of f(N) .      Constraints  0 \leq N \leq 10^{18}         Input Input is given from Standard Input in the following format:  N       Output Print the number of trailing zeros in the decimal notation of f(N) .        Sample Input 1 12      Sample Output 1 1  f(12) = 12 × 10 × 8 × 6 × 4 × 2 = 46080 , which has one trailing zero.       Sample Input 2 5      Sample Output 2 0  f(5) = 5 × 3 × 1 = 15 , which has no trailing zeros.       Sample Input 3 1000000000000000000      Sample Output 3 124999999999999995

Solution (Python):

def resolve():
    N = int(input())

    if N % 2 == 1:
        return print(0)

    ans = 0
    tmp = N // 2
    while tmp:
        tmp //= 5
        ans += tmp
    print(ans)


if __name__ == "__main__":
    resolve()

Solution (Python):
n = int(input())

ans = 0
if n % 2 == 0:
    for i in range(1, 36):
        k = 5**i*2
        ans += n//k
    print(ans)
else:
    print(ans)

Solution (Python):


n = int(input())

def g1(n, p): 
    ''' 
    How many times can n! be divided by p?
    '''
    if n == 0:
        return 0
    return n//p + g1(n//p, p)

def g2(n, p): 
    ''' 
    How many times can n!! be divided by p?
    '''
    if n%2 == 1:
        return g1(n, p) - g2(n-1, p)

    res = g1(n//2, p)
    if p == 2:  
        res += n//2
    return res 

ans = min(g2(n, 5), g2(n, 2)) 
print(ans)

Solution (Python):
n = int(input())
if n%2 == 1:
    print(0)
    exit()
num = 5
i = 1
ans = 0
while num**i < n:
    ans += n//num**i//2
    i += 1
print(ans)

Solution (Python):


n = int(input())

if n%2 == 1:
    print(0)
    exit()

mp = tmp = 0 
while True:
    if 5**tmp > n:
        break
    mp = tmp 
    tmp += 1

ans = 0 
for i in range(1, mp+1):
    ans += n//(2*(5**i))

print(ans)

Solution (Python):
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush

sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()

ans = 0
if n % 2 == 1:
    ans = 0
else:
    div = 10
    while div <= n:
        ans += n // div
        div *= 5

print(ans)

Solution (Python):
n = int(input())
if n % 2 == 1:
    print(0)
    exit()

cnt = 0
x = 1
while n > 5**x:
    cnt += n//5**x//2
    x += 1
print(cnt)

Solution (Python):
import math
N = int(input())
ans = 0
if N == 0 or N % 2 == 1:
    ans = 0
else:
    
    digN = round( math.log(N , 5) )

    i = 1
    while i <= digN:
        ans +=  ( N //( 5 ** i * 2 ) )
        i += 1

print(ans)

Solution (Python):
n=int(input())
if n%2==1:
    print("0")
    exit()
count=0
for i in range(1,30):
    count+=n//(2*5**i)
print(count)

Solution (Python):
N = int(input())
if N%2==1:
  print(0)
else:
  ans = 0
  judge = 10
  while True:
    if judge > N:
      break
    else:
      ans += N//judge
      judge *= 5
  print(ans)

Solution (Python):
n = int(input())
if n%2 ==1:
    print(0)
    exit()
cnt = 0
i = 1

if n%2 == 0:
    while n//(2*(5**i)) > 0:
        cnt += n//(2*(5**i))
        i +=1
print(cnt)

Solution (Python):
n = int(input())
if n%2 != 0:
    print(0)
else:
    ans = 0
    dum = 5
    while n > dum:
        ans += (n//dum)//2
        dum = dum*5
    print(ans)

Solution (Python):
n = int(input())
if n % 2: print(0); exit()
n //= 2
ans = 0

while n >= 5:
    n //= 5
    ans += n
print(ans)

Solution (Python):
N = int(input())
if N % 2 == 1:
    print(0)
    exit()
tmp = 2
ans = 0
while tmp < N:
    tmp *= 5
    ans += N // tmp
print(ans)

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    N = int(input())

    if N % 2 == 1:
        print(0)
        exit()

    count = []
    i = 0
    while True:
        q = N // (10 * 5 ** i)
        if q == 0:
            break
        else:
            count.append((q, i + 1))
            i += 1

    ans = 0
    prev_c = 0
    for c, n_zero in count[::-1]:
        ans += n_zero * (c - prev_c)
        prev_c = c

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
if N%2 == 1 :
    print(0)
    exit()
n = 0
i = 0
for i in range(1,26) :
    n += N//((5**i)*2)

print(n)

Solution (Python):
n=int(input())
if n%2==1:
  print(0)
  exit()
else:
  ans=0
  u=10
  while n//u>=1:
    ans+=n//u
    u=u*5
  print(int(ans))

Solution (Python):
n = int(input())
if n % 2 == 1:
    print(0)
    exit()

ans = 0
cnt = 0
ones = 0
keta = []
cnt = 5 * 2
while n >= cnt:
    ans += n // cnt
    cnt *= 5

print(ans)

Solution (Python):
n = int(input())
if n%2!=0:
    print(0)
else:
    cnt = 0
    n = n//2
    while n>0:
        cnt = cnt + (n//5)
        n = n//5
    print(cnt)

Solution (Python):
n = int(input())
if n % 2 != 0:
    print(0)
else:
    ans = 0
    t = 10
    while t <= n:
        ans += n//t
        t *= 5
    print(ans)

Solution (Python):
N = int(input())
if N%2:
    print(0)
else:
    ans = 0
    N //= 2
    while N:
        N //= 5
        ans += N
    print(ans)

Solution (Python):
def fac1(num, div):
    """How many times can the factorial of `num` be divided by `div`?"""
    if num == 0:
        return 0
    return num // div + fac1(num // div, div)


def fac2(num, div):
    """How many times can the double factorial of `num` be divided by `div`?"""
    return fac1(num // 2, div)


def main():
    num = int(input())
    if num % 2 == 1:
        return 0
    else:
        return fac2(num, 5)


if __name__ == '__main__':
    ans = main()
    print(ans)

Solution (Python):


import sys
from math import factorial
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)


N = int(input())

if N % 2:
    print(0)
    sys.exit()


div = 10
count = 0
while N // div:
    count += N // div
    div *= 5


print(count)

Solution (Python):
N=int(input())

if N%2:
    print(0)
else:
    X=0
    Y=N//5
    while Y:
        X+=Y//2
        Y//=5
    print(X)

Solution (Python):
N = int(input())
out=0

if N%2 ==1:
    out=0

else:
    k=5
    while k<10**18:
        out+= (N//k)//2
        k*=5

print(out)

Solution (Python):
def calculate(n):
    if n % 2 == 1:
        return 0
    s1 = n // 10
    index = 1
    s2 = 0
    while (5 ** index) <= s1:
        s2 += (s1 // (5 ** index))
        index += 1
    return s1 + s2
print(calculate(int(input())))

Solution (Python):
n,ans = int(input()),0
if not n%2:
    for i in range(1,30):
        ans+=n//(5**i*2)
print(ans)

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
 
def main():
    n=int(input())
    if n%2==1:
        print(0)
    else:
        m=n//2
        ans=0
        for i in range(1,30):
            ans+=m//(5**i)
        print(ans)

 
if __name__=='__main__':
    main()

Solution (Python):
N = int(input())

if (N%2 == 1):
    print(0)
elif N == 0:
    print(0)
else:
    N //= 2
    res = 0
    div_coef = 1
    while True:
        tmp_add = N // (5 ** div_coef)
        res += int(tmp_add)
        div_coef += 1
        
        if tmp_add < 1:
            break
    
    print(int(res))

Solution (Python):
import sys
input = sys.stdin.readline

n = int(input())

a = 0

if n % 2 == 1:
    a == 0
else:
    n = n // 2
    k = 5
    while k <= n:
        a += n // k
        k *= 5

print(a)

Solution (Python):
def cin():
    in_ = list(map(int,input().split()))
    if len(in_) == 1:  return in_[0]
    else:  return in_

def fact_prime(n, p):
    ret = 0
    temp = p
    while(n >= p):
        ret += n // p
        p *= temp
    return ret

n = cin()

if n % 2:
    n = (n + 1) // 2
    a2 = fact_prime(2 * n, 2)
    a5 = fact_prime(2 * n, 5)
    b2 = fact_prime(n, 2) + n
    b5 = fact_prime(n, 5)
    ans = min(a2 - b2, a5 - b5)
else:
    n = n // 2
    ans = fact_prime(n, 5)
print(ans)

Solution (Python):
import sys
from io import StringIO
import unittest
import os




def resolve(test_def_name=""):
    
    n = int(input())

    if n % 2 == 1:
        print(0)
        return

    ans = 0
    val = 2
    
    for i in range(30):
        val = val * 5
        if val > n:
            break
        ans += n // val

    print(ans)



class TestClass(unittest.TestCase):
    def assertIO(self, assert_input, output):
        stdout, sat_in = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(assert_input)
        resolve(sys._getframe().f_back.f_code.co_name)
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, sat_in
        self.assertEqual(out, output)

    def test_input_1(self):
        test_input = """12"""
        output = """1"""
        self.assertIO(test_input, output)

    def test_input_2(self):
        test_input = """5"""
        output = """0"""
        self.assertIO(test_input, output)

    def test_input_3(self):
        test_input = """1000000000000000000"""
        output = """124999999999999995"""
        self.assertIO(test_input, output)

    
    def tes_t_1original_1(self):
        test_input = """データ"""
        output = """データ"""
        self.assertIO(test_input, output)



if __name__ == "__main__":
    if os.environ.get("USERNAME") is None:
        
        resolve()

    else:
        
        unittest.main()

Solution (Python):
N = int(input())

if N%2 == 1:
    print(0)
    exit()

ans = 0
for i in range(30):
    ans += N//(2*5**(i+1))
print(ans)

Solution (Python):
N = int(input())
if N % 2 == 1:
    print('0')
    exit()

N //= 2
ans = 0
while N:
    ans += N // 5
    N //= 5
print(ans)

Solution (Python):
N = int(input())
a = 10
count = 0
if N%2 == 1:
    print(0)
    exit()
else:
    while a <= N:
        count += N//a
        a *= 5
print(count)

Solution (Python):
N = int(input())
n = 0
if not N%2:
    s = 5
    N = N//2
    while N>=s:
        n += N//s
        s *= 5
print(n)

Solution (Python):
N = int(input())

ans = 0
if N % 2 == 0:
  f = 1
  x = N //( 2*(5**f))
  while x != 0:
    x =  N //( 2*(5**f))
    ans += x
    f += 1
print(ans)

Solution (Python):
n=int(input())
if n==0 or n%2==1:
  print(0)
else:
  k=n//2
  s=5
  ans=0
  while k>=s:
    ans+=k//s
    s*=5
  print (ans)

Solution (Python):
N=int(input())

if N<2 or N%2:
    print(0)
else:
    import math
    ans=0
    n=N//2
    k=int(math.log(n,5))
    for i in range(1,k+1):
        ans+=n//(5**i)
        
    print(ans)

Solution (Python):

n = int(input())
if n % 2 > 0:
    print(0)
else:
    n //= 2
    c = 0
    while n > 0:
        c += n // 5
        n //= 5
    print(c)

Solution (Python):
n = int(input())
if n%2:
    print(0)
else:
    ans = 0
    for i in range(1,100):
        ans += (n//(5**i*2))
        if n < 5**i:
            break
    print(ans)

Solution (Python):
def input_li():
    return list(map(int, input().split()))

def input_int():
    return int(input())

N = input_int()
if N % 2 == 0:
    ans = 0
    N //= 2
    while N > 0:
        ans += N // 5
        N //= 5
    print(ans)
else:
    print(0)

Solution (Python):
N = int(input())

if N % 2 == 1:
    print(0)
    exit()

res = 0
fives = 10
while True:
    if N // fives == 0:
        break
    res += N//fives
    fives *= 5
print(res)

Solution (Python):
N = int(input())
N1 = N // 10
if N % 2 == 1:
    print(0)
else:
    counter = 0
    div = 10
    while True:
        num = N // div
        if num == 0:
            break
        counter += num
        div *= 5
    print(counter)

Solution (Python):
N = int(input())

if N % 2 == 1:
  print(0)
else:
  rlt = 0
  i = 10
  while N // i > 0:
    rlt += N // i
    i *= 5
  print(rlt)

Solution (Python):
n = int(input())
if n % 2 == 1:
  print(0)
else:
  a = 0
  m = n // 2
  while True:
    m = m // 5
    a += m
    if m == 0:
      break
  print(a)

Solution (Python):
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
import math
from copy import deepcopy
import queue


Mod = 1000000007
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1] 
for i in range(2, 10**5 + 1):
    fact.append((fact[-1] * i) % Mod)
    inv.append((-inv[Mod % i] * (Mod // i)) % Mod)
    factinv.append((factinv[-1] * inv[-1]) % Mod)
    
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % p
    
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[y] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)
def pow_k(x, n):

    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2

    return K * x
def main():  
    n = int(input())
    i = 0
    ans = 0
    if n % 2 == 0:
        while 10*5 ** i <= n:
            ans += n // (10* 5**i)
            i += 1
    print(ans)
if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())

ans = 0
if n%2 == 0:
    i = 10
    while i <= n:
        ans += n//i
        i *= 5

print(ans)

Solution (Python):

N = int(input())

if N % 2 == 1:
    print(0)
else:
    ans = 0
    div = 1
    for _ in range(100):
        div *= 5
        ans += N // (div * 2)

    print(ans)

Solution (Python):

N = int(input())

if N % 2 == 1:
    print(0)
else:
    ans = 0
    div = 10
    for _ in range(100):
        ans += N // div
        div *= 5

    print(ans)

Solution (Python):
n=int(input())

if n<2 or n%2==1:
  print(0)
else:
  ans=0
  now=10
  while(now<=n):
    ans+=n//now
    now*=5
  print(ans)

Solution (Python):
N=int(input())

ans=0
if ~N%2:
    for i in range(1,30):
        ans+=N//(2*5**i)
print(ans)

Solution (Python):
N=int(input())

ans=0
if ~N%2:
    for i in range(1,30):
        ans+=N//(10*5**i)
    ans+=N//10
print(ans)

Solution (Python):
n = int(input())
if n % 2 == 1:
    print(0)
else:
    ans = 0
    for i in range(0,25):
        ans += n//(10*5**i)
    print(ans)

Solution (Python):
n = int(input())
if n%2==1:
  print(0)
else:
  ans = 0
  div = 10
  pt = 1
  while div<=n:
    ans += n//div
    div *=5
  print(ans)

Solution (Python):
n = int(input())

if n % 2 == 1:
    print(0)
elif n % 2 == 0:
    ans = 0
    k = 10
    while n >= k:
        ans += n//k
        k *= 5
        
    print(ans)

Solution (Python):
import math
n = int(input())
cnt = 0
mod = 10
if n%2 == 1:
    print(0)
    exit()
while mod<=n:
    cnt += n//mod
    mod*=5
print(cnt)

Solution (Python):
import sys
s=0
N=int(input())
if N%2==1:
  print(0)
  sys.exit()
N=N//2
while True:
  N=N//5
  s+=N
  if N==0:
    break
print(s)

Solution (Python):
from math import ceil, log
n = int(input())
if n%2==1:
    print(0)
else:
    print(sum([n//(2*pow(5,i)) for i in range(1,ceil(log(n+1,5)))]))

Solution (Python):
def count_five(n):
    res = 0
    i = 1
    while n//pow(5,i) - n//pow(10,i)> 0:
        res += n//pow(5,i) - n//(2*pow(5,i))
        i += 1
    return res

def main(N):
    if N%2:
        return 0
    M = list(str(N))
    L = len(M)
    temp = 0
    temp2 = 0
    res = 0
    for i, n in enumerate(M[:-1], start=1):
        temp *= 10
        temp += int(n)
        res += (temp - temp2)*(L-i)
        res += count_five(temp)
        temp2 = temp
    return res

N = int(input())
print(main(N))

Solution (Python):
def resolve():
    N = int(input())
    if N%2 == 1:
        print(0)
    else:
        ans = 0
        for i in range(0, 50):
            ans += N//(10*(5**i))
        print(ans)
    
if __name__ == "__main__":
    resolve()

Solution (Python):
n = int(input())
if n % 2 == 1:
    print(0)
    exit()
ans = 0
n //= 2
while n > 0:
    ans += n // 5
    n //= 5
print(ans)

Solution (Python):
n=int(input())
if n%2!=0:
  print(0)
else:
  ans=0
  t=10
  while True:
    ans=ans+n//t
    t=t*5
    if n//t==0:
      break
  print(ans)

Solution (Python):

from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools, bisect
import math, fractions
import sys, copy

def L(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline().rstrip())
def S(): return list(sys.stdin.readline().rstrip())
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
def LR(n): return [L() for _ in range(n)]

alphabets = "abcdefghijklmnopqrstuvwxyz"

sys.setrecursionlimit(1000000)
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007

def main():
    N = I()

    if N % 2 == 1:
        print(0)

    else:
        ans = 0
        for i in range(1, 30):
            ans += N // (2 * 5 ** i)

        print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
ans = 0
d = 10
if n%2==1:
    print(0)
    import sys
    sys.exit()
while True:
    ans += n//d
    d *= 5
    if d>n:
        break
print(ans)

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())

ans = 0
if N%2==1:
    print(0)
    exit(0)
for i in range(1, 40):
    cnt = N//(5**i)
    ans += cnt//2
print(ans)

Solution (Python):
N = int(input())

if(N%2 != 0):
    print(0)
else:
    cnt = 0
    n = 1
    while n <= N:
        n *= 5
        if(n > N):
            break
    
        num = n*2
        cnt += N//num
    print(cnt)

Solution (Python):

import math
n = int(input())
ans = 0
i = 1
if n % 2 == 0:
    tmp = 5 ** i * 2
    while tmp <= n:
        tmp = 5 ** i * 2
        ans += n //tmp
        i += 1
    print(ans)
else:
    print(0)

Solution (Python):
import math
n = int(input())
ten_counter = 0
exp_index = math.log(10 ** 18, 5)
if n % 2 == 0:
    n //= 2
    
    for i in range(1, int(exp_index) + 1):
        if n // (5 ** i) == 0:
            break
        else:
            ten_counter += n // (5 ** i)
    
    
else:
    pass

print(ten_counter)

Solution (Python):
import math

n = int(input())


if n % 2 == 1:
    print(0)
else:
    s = 0
    p = 0
    while 10 * (5 ** p) <= n:
        s += n // (10 * (5 ** p))
        p += 1
    print(s)

Solution (Python):
import sys
N = int(input())
if N % 2 != 0:
    print(0)
    sys.exit()
N //= 2
ans = 0
while N != 0:
    ans += N//5
    N //= 5

print(ans)

Solution (Python):
n=int(input())
c=0
m=n/2
while m>=5:
  m/=5
  c+=1
sm=0
for i in range(c):
  sm+=(n//2)//(5**(i+1))
print(sm if n%2==0 else 0)

Solution (Python):






N = int(input())





ans = 0
if N%2 != 0:
    print(ans)
else:
    i = 1
    while 1:
        tmp = (5**i)*2
        if tmp <= N:
            ans += N//tmp
            i += 1
        else:
            break
    print(ans)

Solution (Python):
N = int(input())

if N%2 == 1 or N <= 9:
  print(0)
else:
  t = 10
  ans = 0
  while N >= t:
    ans += N//t
    t *= 5
  print(ans)

Solution (Python):
n = int(input())

if n % 2 == 1:
    print(0)
    exit()

elif n % 2 == 0:
    ans = 0
    t = 10
    while n >= t:
        ans += n // t
        t *= 5
    print(ans)

Solution (Python):
N = int(input())
ans = 0

if N%2 == 1 or N <= 9:
  print(0)
else:
  i = 10
  while N >= i:
    ans += N//i
    i *= 5
  print(ans)

Solution (Python):
n=int(input())
ans = 0
t = 10
while n >= t:
  ans += n//t
  t *= 5

if n % 2 == 0:
  print(ans)
else:
  print(0)

Solution (Python):
def solve(n):
    if n % 2 == 1:
        return 0 
    div_2 = 0
    cur = 2
    while cur <= n:
        div_2 += (n // cur)
        cur = cur * 2
    div_5 = 0
    cur = 5
    while cur <= n:
        div_5 += (n // cur) // 2
        cur = cur * 5
    return min(div_2, div_5)

n = int(input())
print(solve(n))

Solution (Python):
n = int(input())
if n % 2 != 0:
    print(0)
    exit()

m = 10
a = []
b = []
while m <= n:
    a.append(n // m)
    m *= 5
    if len(a) > 1:
      b.append(a[-2] - a[-1])
if a:
    b.append(a[-1])

ans = 0
for i in range(len(b)):
    ans += (i+1)*b[i]
print(ans)

Solution (Python):
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()
    
    n = int(input())
    if n%2 == 1:
        print(0)
        exit(0)
    
    def count(k, n):
        now = k
        cnt = 0
        while now <= n:
            cnt += n//now
            now *= k
        return cnt

    n //= 2
    ans = count(5, n)
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()
    
    n = int(input())
    if n%2 == 1:
        print(0)
        exit(0)
    
    def count(k, n):
        now = k
        cnt = 0
        while now <= n:
            cnt += n//now
            now *= k
        return cnt

    n //= 2
    cnt2 = n
    cnt2 += count(2, n)
    cnt5 = count(5, n)
    ans = min(cnt2, cnt5)
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    if n % 2:
        print(0)
        exit()
    n //= 2
    res = 0
    while n:
        res += n // 5
        n //= 5
    print(res)


if __name__ == '__main__':
    resolve()

Solution (Python):
n=int(input())
if n%2==1:
  ans=0
else:
  m=n//10
  ans=m
  for i in range(1,30):
    ans += m//(5**i)
print(ans)

Solution (Python):

import sys

sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
from heapq import heappop, heappush

sys.setrecursionlimit(10**7)







def run():
    N = int(input())
    if N % 2:
        print(0)
    else:
        ans = 0
        div = 10
        while True:
            val = N // div
            ans += val
            if not val:break
            div *= 5
        print(ans)

if __name__ == "__main__":
    run()

Solution (Python):
def main():
    n = int(input())
    if n%2==1:
        print(0)
        return
    md = 10
    cnt = 0
    while n>=md:
        cnt += n//md
        md = md*5
    print(cnt)

if __name__ == "__main__":
    main()

Solution (Python):
from sys import stdin
input = stdin.readline


def main():
  N = int(input())

  if N % 2:
    print(0)
    return

  nz = 0
  i = 1
  while True:
    if N//(5**i)//2 > 0:
      nz += (N//(5**i)//2)
      i += 1
    else:
      break

  print(nz)


if(__name__ == '__main__'):
  main()

Solution (Python):
N = int(input())
n = N // 10
cnt = 0
if N % 2 == 0:
    while n != 0:
        cnt += n
        n //= 5
print(cnt)

Solution (Python):
N = int(input())
n = N // 10
cnt = 0

while n != 0:
    cnt += n
    n //= 5
print(cnt if N % 2 == 0 else 0)

Solution (Python):
N = int(input())
if N % 2 == 1:
    print(0)
    exit()
ans = 0
i = 1
while 5 ** i * 2 <= N:
    ans += N // (5 ** i * 2)
    i += 1
print(ans)

Solution (Python):
def main():
    n = int(input())
    if n < 10 or n % 2 == 1:
        print(0)
    else:
        ans = 0
        i = 10
        while i <= n:
            ans += n // i
            i *= 5
        print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n = int(input())

if n & 1:
    print(0)
    exit()

ans = 0
n //= 2
while n:
    ans += n // 5
    n //= 5
print(ans)

Solution (Python):
N = int(input())







if N % 2 != 0:
    print(0)
    exit()

cnt = 0
current = 5
while (N // 2 >= current):
    cnt += (N // 2 // current)
    current *= 5

print(cnt)

Solution (Python):
n = int(input())

























k = 10
ans = 0
while k <= n:
    ans += n // k
    k = k * 5
print(ans if n % 2 == 0 else 0)

Solution (Python):
N = int(input())

if N%2==1:
    print(0)
else:
    i = 10
    count = 0
    while i <= N:
        count += N//i
        i = i*5

    print(count)

Solution (Python):





import math
import fractions
import sys
import bisect
import heapq  
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr



def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod



def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


inf = 10 ** 18
mod = 10 ** 9 + 7

n = ir()
if n%2 == 1:
    print(0)
else:
    ans = 0
    tmp = 2
    dp = [0 for i in range(50)]
    for i in range(1,50):
        if tmp < 10**18:
            tmp = tmp*5
            dp[i-1]=n//tmp
        else:
            break
    for i in range(49):
        ans+=(dp[i]-dp[i+1])*(i+1)
    print(ans)

Solution (Python):
N = int(input())

if N % 2 == 1:
    print(0)
else:
    n = 0
    i = 1
    while True:
        if N < 2*5**i:
            break
        n += (N // 5**i // 2)
        i += 1
    print(n)

Solution (Python):

from collections import Counter
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n = I()
if n % 2 != 0:
    print(0)
    exit()
ans = 0
i = 10
while i <= n:
    ans += n // i
    i *= 5
print(ans)

Solution (Python):

from collections import Counter
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n = I()
if n % 2 != 0:
    print(0)
    exit()
ans = n // 10
i = 50
while i <= n:
    ans += n // i
    i *= 5
print(ans)

Solution (Python):
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
ans = 0

if n % 2 == 0:
    c5 = 0
    c2 = 0
    for i in range(30,0,-1):
        c5 += i*(n//(2*5**i) - n//(2*5**(i+1)))
    for i in range(60,0,-1):
        c2 += i*(n//(2**i) - n//(2**(i+1)))
    ans = min(c5, c2)

print(ans)

Solution (Python):
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
if N % 2 == 1:
    print(0)
    sys.exit()
ans = 0
i = 1
while True:
    div = 5 ** i
    cnt = N // div
    cnt //= 2
    if cnt == 0:
        break
    ans += cnt
    i += 1
print(ans)

Solution (Python):


import math

import itertools
from collections import deque
from collections import Counter



import bisect
n=int(input())
a=5
ans=0
if n%2==1:
  print(0)
  exit()
while True:
    if a>n:
        break
    ans+=(n//a)//2
    a*=5
print(ans)

Solution (Python):
import sys

n = int(input())
if n % 2 == 1:
  print(0)
  sys.exit()
ans = 0
x = 2
while n >= x:
  x *= 5
  ans += n // x
print(ans)

Solution (Python):
import sys
n = int(input())
ans = 0
i = 1
if n%2 == 1:
    print(ans)
    sys.exit()

while True:
    d = 5**i
    if d > n//2:
        break
    else:
        ans += ((n//2) - (n//2)%d)//d
        i += 1
print(ans)

Solution (Python):
N = int(input())
M = 10
ans = 0

if N % 2 == 0:
  while N >= M:
    ans += N//M
    M *= 5
print(ans)