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



Sample input:
12


Sample output:
1

Submission status: Accepted

Solution code:
def p(fl):
    ans = 0
    while n>=fl:
        ans+=n//fl
        fl*=5
    return ans

n = int(input())

print(p(10) if n%2==0 else 0)

Submission status: Accepted

Solution code:
n=int(input())


def findTrailingZeros(n):
    # Initialize result
    count = 0

    i = 10

    while (i<=n):
        count+=n//i
        i *= 5

    return count


if n % 2 == 1:
    print(0)
else:
 get5s=findTrailingZeros(n)
 print(get5s)

Submission status: Accepted

Solution code:
n = int(input())
if n%2:
    print(0)
else:
    ans = 0
    x = 10
    while n>=x:
        ans += n//x
        x *= 5
    print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
if n & 1:
    print(0)
    exit(0)
for i in range(100):
    tmp = pow(5, i) * 10
    contrib = n//tmp
    if contrib == 0:
        break
    ans += contrib
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
i = 10
c = 0
if N%2 == 0:
    while(N >= i):
        c += N // i
        i *= 5
    print(c)
else:
    print(0)

Submission status: Accepted

Solution code:
n = int(input())
k = 10
ans = 0


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

def k_change():
	global k
	k = k*5


def func(n):
	global ans,k
	#print(k)
	if n < k:
		print(ans)
		exit()
	ans += n//k
	k_change()
	func(n)

func(n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
count=0
k=10
n=int(input())
if n%2==1:
    print(0)
else:
    for i in range(1,100):
        count+=int(n//(k))
        k*=5
    print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
if N%2==0:
  p=10
  cnt=0
  while N//p!=0:
    cnt=cnt+N//p
    p=p*5
  print(cnt)
else:
  print(0)

Submission status: Accepted

Solution code:
n = int(input())
fives = n
cnt = 0
cnt2 = 0

if n%2 == 0:
  while (1):
    if fives // 5 > 0:
      fives //= 5
      cnt += 1
    else:
      break

for i in range(cnt):
  cnt2 += n // (2*5**(i+1))

print(cnt2)

Submission status: Accepted

Solution code:
n, r = divmod(int(input()),2)
ans = 0
i = 1

if not r:
    while n >= 5**i:
        ans += n//(5**i)
        i += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
if N % 2 != 0:
    res = 0
else:
    LIM = int(pow(1000000000000000000, 1/5))+1
    res = 0
    for i in range(1, LIM):
        res += N // (2 * 5**i)
print(res)

Submission status: Accepted

Solution code:
n_2,r= divmod(int(input()),2)
ans=0
i=1
if not r:
  while n_2 >= 5**i:
    ans += n_2//(5**i)
    i+=1
print(ans)

Submission status: Accepted

Solution code:
import sys

N = int(input())

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

ans = 0
i = 1
while (N//2)>=5**i:
    ans += (N//2)//(5**i)
    i += 1

print(ans)

Submission status: Accepted

Solution code:
import sys
N = int(input())
if N % 2 != 0:
    print(0)
    sys.exit()

answer = 0
for i in range(36, 0, -1):
    n = 5 ** i
    answer += (N // n // 2)
print(answer)

Submission status: Accepted

Solution code:
def wczytaj_liste(): 
    wczytana_lista = input()
    lista_znakow = wczytana_lista.split()
    ostateczna_lista = []
    for element in lista_znakow:
        ostateczna_lista.append(int(element))
    return ostateczna_lista

def Double_Factorial():
    N = wczytaj_liste()[0]
    if N < 10: 
        print (0)
    elif N%2 == 1: 
        print(0)
    else:
        podzielnik = 10
        wynik = 0
        while podzielnik <= N:
            wynik += N//podzielnik
            podzielnik *= 5
        print(wynik)
            
Double_Factorial()

Submission status: Accepted

Solution code:
n = int(input())

def formula(x, p):
    return 0 if p>x else (x//p)+formula(x//p,p)

def calc(x):
    two = x//2
    two += formula(x//2, 2)
    five = formula(x//2, 5)
    return min(two, five)

print("%d"% (0 if n%2==1 else calc(n)) )

Submission status: Accepted

Solution code:
n = int(input())

def g1(n, p):
    if n == 0:
        return 0
    return n//p + g1(n//p, p)

def g2(n, 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,2), g2(n,5))
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = int(input())
if n % 2 == 1:
    print(0)
    exit()
ans = 0
while n > 0:
    n //= 5
    ans += n // 2
print(ans)

Submission status: Accepted

Solution code:
count=0
k=10
n=int(input())
if n%2==1:
    print(0)
else:
    for i in range(1,100):
        count+=n//(k)
        k*=5
    print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
start = 10

if N % 2 == 0:
    while start <= N:
        ans += N // start
        start = start * 5
    print(ans)
else:
    print(0)

Submission status: Accepted

Solution code:
n = int(input())
if n % 2 == 1:
    print(0)
    quit()
i = 10
ans = 0
while n >= i:
    ans += n // i
    i *= 5
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import math

def solve(N: int):
    ans=0
    if N%2==0:
        n5=10
        while(N>=n5):
            ans+=max(0,N//n5)
            n5*=5
    print(ans)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys

################ DANGER ################
test = ""
#test = \
"""
1000000000000000000
124999999999999995
"""
########################################
test = list(reversed(test.strip().splitlines()))
if test:
    def input2():
        return test.pop()
else:
    def input2():
        return input()
########################################
        

n = int(input2())
if n % 2:
    print(0)
    sys.exit()
    
    
ans = 0
i = 0
while (10 * 5**i) <= n:
    ans += n // (10 * 5**i)
    i += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
 
if n % 2 != 0:
    ans = 0
    print(ans)
    exit()
 
f = 10
ans = 0
while f <= n:
    ans += n // f
    f *= 5
 
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
c = 0
if n % 2 == 1:
  print(c)
else:
  temp = n // 10
  c = c + temp
  while temp/5 > 0:
    temp = temp // 5
    c = c + temp
  print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
N = int(input())

def main(N):
    if N % 2 == 1:
        print(0)
        return
    n = 1
    ans = 0
    N //= 2
    while N:
        N //= 5
        ans += N
    print(ans)

if __name__ == "__main__":
    main(N)

Submission status: Accepted

Solution code:
n = int(input())

if n % 2 != 0:
    ans = 0
    print(ans)
    exit()

f = 10
ans = 0
while f <= n:
    ans += n // f
    f *= 5

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if n%2!=0:
    print("0")
else :
    x = 0
    n//=2
    while n:
        n //=5
        x += n
    print(x)

Submission status: Accepted

Solution code:
N = int(input())
NN = N
if N % 2 != 0:
    print(0)
    exit()

ans = 0
tmp_list = [0] * 40
for i in range(40):
    tmp_list[i] = N // (10 * 5 ** i)
ans = sum(tmp_list)
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

N = int(input())

def g1(n, p):
    if n == 0:
        return 0

    return n // p + g1(n // p, p)


def g2(n, 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, 2), g2(N, 5))
print(ans)

Submission status: Accepted

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

ans = 0
tmp = 10
while tmp <= n:
  ans += n // tmp
  tmp *= 5
  if tmp > n:
    break
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

result = 0
if n % 2 == 1:
    result = 0
else:
    
    while n >= 1:
        result += n // 10
        n = n // 5
        
print(result)

Submission status: Accepted

Solution code:
N = int(input())

if N%2 == 1:
    cnt = 0
else:
    cnt = 0
    a = 1
    while (5**a)*2<=N:
        cnt += N//((5**a)*2)
        a += 1

print(cnt)

Submission status: Accepted

Solution code:
#coding;utf-8
n = int(input())
#nが奇数の場合は0
if n % 2 != 0:
    print(0)
    exit()
#偶数の場合は、2と5で割り切れる数を数える
else:
    n //= 10
    ans = n
    while n > 0:
        n //= 5
        ans += n
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
tmp = 10
if N%2 == 1:
    print(0)
    exit()

while N/tmp >= 1:
    ans += N//tmp
    tmp *= 5
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

if n % 2 != 0:
    ans = 0
else:
    ans = 0
    n //= 2
    while n:
        ans += n // 5
        n //= 5

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if n % 2:
    print(0)
else:
    ans, x = 0, 5
    while(x <= n):
        ans += ((n // x) // 2)
        x *= 5
    print(ans)

Submission status: Accepted

Solution code:
def main():
    N = input()
    if int(N) % 2 == 1:
        print(0)
        exit()
    cnt5 = 0
    for i in range(1,100):
        tmp =  int(N) // (5 ** i)
        cnt5 += tmp // 2
    print(cnt5)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())


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

ans = 0
d = 10
while d <= N:
    ans += N // d
    d *= 5

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if n % 2 == 0:
  zeros = 0
  n //= 2
  while n >= 5:
    z = n // 5
    zeros += z
    n = z
  print(zeros)
else:
  print(0)

Submission status: Accepted

Solution code:
N=int(input())

if N%2==1:
    print(0)
else:
    half_N = N//2
    count = 0
    ord = 1

    temp_count = half_N//(5**ord)
    count += temp_count
    while temp_count>0:
        ord += 1
        temp_count = half_N//(5**ord)
        count += temp_count
    print(count)

Submission status: Accepted

Solution code:
max_n = 10**18

n = int(input())
  
if n % 2 == 1:
  print(0)
else:  
  ans = d = i = 0
  while n >= d:
    d = 2 * 5**(i+1)
    ans += n // d  
    i+=1
  print(ans)

Submission status: Accepted

Solution code:
import math
n = int(input())
 
if n%2 == 1:
  print(0)
else:
  out = 0
  n //= 2
  x = math.log((10**18)//2, 5)
  for i in range(math.floor(x)):
    out += n // 5**(i+1)
 
  print(out)

Submission status: Accepted

Solution code:
import math
n = int(input())

if n%2 == 1:
  print(0)
else:
  out = 0
  n //= 2
  x = math.log((10**18)//2, 5)
  for i in range(math.floor(x)):
    out += n // 5**(i+1)

  print(out)

Submission status: Accepted

Solution code:
N = int(input())
i = len(str(N))-1

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
if n%2:
  print(0)
else:
  x = n//2
  k=0
  while x>0:
    k+=x//5
    x//=5
  print(k)

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def main():
    s = S()
    N = int(s)
    if N % 2 == 1:
        print(0)
        return
    dig = len(s)
    cnt = 0
    for i in range(1, 36):
        if 5 ** i > N//2:
            break
        cnt += (N // 2) // (5**i)
    print(cnt)
main()

Submission status: Accepted

Solution code:
import math
def calc(n,x):
    return n//x

n=int(input())
if n%2==1 or n==0:
    print(0)
else:
    ans=0
    m=10
    while m<=n:
        ans+=calc(n,m)
        m*=5
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
ans = 0
if N[-1] in ['1','3','5','7','9']:
  ans = 0
else:
  N = int(N)
  while N >= 10:
    ans += N // 10
    N = N // 5
    
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if n % 2 != 0:
    print(0)
    exit()
cnt = 0
i = 5
while i <= n :
    cnt += n // i // 2
    i *= 5
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
cnt = 0
i = 0
if N%2 == 1:
	cnt = 0
else:
	while N >= 10*(5**i):
		cnt += N//(10*(5**i))
		i += 1
		#print(10*(5**i), N//(10*(5**i)))
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
def cal_func(x):
	ans = 0
	N = 10
	while N <= x:
		ans += x // N
		N = N * 5
	return ans
if n % 2 == 1:
	ans = 0
else:
	ans = cal_func(n)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

if N % 2 == 1:
    print(0)
    exit()
now_5 = 5
ans = 0
while now_5 <= N:
    ans += (N//now_5)//2
    now_5 *= 5
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
res = 0
mod = 2
if N % 2 == 0:
    while N // mod != 0:
        mod *= 5
        res += (N // mod)
print(res)

Submission status: Accepted

Solution code:
n = int(input())

if n % 2 != 0:
    print(0) # 奇数は10が現れない
else:
    m = 10
    count = 0
    while m <= n:
        count += n // m
        m *= 5
    print(count)

Submission status: Accepted

Solution code:
n=int(input())
g=0
if n%2!=1:
 t=10
 while t<=n:
  g+=n//t
  t*=5
print(g)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#solve
def solve():
    n = II()
    if n & 1:
        print(0)
        return
    a5 = 5
    a2 = 0
    ans = 0
    a = n
    while n:
        a2 += n // 2
        n = n // 2
    while a:
        ans += a // 10
        a //= 5
    print(min(a2, ans))
    return


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import copy

n = int(input())
def calc(N):
    n_ = (N - N%10)//10
    c = 1
    s = copy.deepcopy(n_)
    while n_//(5**c) >= 1:
        c +=1
    c -= 1
    for i in range(1,c+1):
        s += n_//5**i
    return s

if n%2 == 1 or n == 0:
    print(0)
else:
    print(calc(n))

Submission status: Accepted

Solution code:
N = int(input())
if N % 2 == 1:
  print(0)
else:
  ans = 0
  F = 10
  while F <= N:
    ans += N // F
    F *= 5
  print(ans)

Submission status: Accepted

Solution code:
N = int(input())

def r(n, p):
  if n == 0:
    return 0
  return n//p+r(n//p, p)

if N % 2 == 0:
  print(r(N//2, 5))
else:
  print(0)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

def check_five(N):
    count = 0
    i = 5
    exp = 1
    while True:
        divided = N // i
        if divided == 0:
            break
        count += divided
        exp += 1
        i = 5 ** exp
    return count

if N % 2 == 0:
    ans = check_five(N//2)
else: 
    ans = 0

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

import sys

n = int(input())

if n % 2 == 1:
    print(0)
    sys.exit()
    
if n < 2:
    print(0)
    sys.exit()
    
l = list()
# 2 * 5
l.append(10)
# 2 * 5 * 5
l.append(50 )
# 2 * 5 * 5 * 5
l.append(250 )
# 2 * 5 * 5 * 5 * 5
l.append(1250 )
# 2 * 5 * 5 * 5 * 5 * 5
l.append(6250 )
# 2 * 5 * 5 * 5 * 5 * 5 * 5
l.append(31250 )
# 2 * 5 * 5 * 5 * 5 * 5 * 5 * 5
l.append(156250 )
# 2 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5
l.append(781250 )
# 2 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5
l.append(3906250 )
# 2 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5
l.append(19531250 )
# 2 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5
l.append(97656250 )
# 2 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5
l.append(488281250 )
# 2 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5
l.append(2441406250 )
# 2 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5
l.append(12207031250 )
# 2 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5
l.append(61035156250 )
# 2 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5
l.append(305175781250 )
# 2 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5
l.append(1525878906250 )
# 2 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5
l.append(7629394531250 )
# 2 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5
l.append(38146972656250 )
# 2 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5
l.append(190734863281250 )
# 2 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5
l.append(953674316406250 )
# 2 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5
l.append(4768371582031250 )
# 2 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5
l.append(23841857910156200 )
# 2 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5
l.append(119209289550781000 )
# 2 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5
l.append(596046447753906000 )

result = 0
for a in l:
    result += n // a
    
print(result)

Submission status: Accepted

Solution code:
N = int(input())
l = len(str(N))
if N < 2:
    print(0)
elif N % 2 == 1:
    print(0)
else:
    ans = 0
 
    for i in range(1, 2*l):
        tmp = 0
        ans += (N // 10**i)
        tmp += (N // (10 * (5**i)))
        tmp -= N // (10 * (10**i))
        ans += max(tmp, 0)
 
    print(ans)

Submission status: Accepted

Solution code:
n = int(input())

if n %2 ==1:
  print(0)
else:
  mod = 10
  ans = 0
  x = 0
  while True:
    x = n//mod
    if x==0: break
    ans+=x
    mod *= 5
  print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if n % 2: print(0)
else:
    ans = 0
    k = 5
    while k < n:
        ans += n // k // 2
        k *= 5
    print(ans)

Submission status: Accepted

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

def check_five(N):
    count = 0
    i = 10
    while True:
        divided = N // i
        if divided == 0:
            break
        count += divided
        i = i * 5
    return count

if N % 2 == 0:
    ans = check_five(N)
else:
    ans = 0

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if n % 2 == 0:
    ans = 0
    a = 10
    while a <= 10**18:
        ans += (n) // a
        a *= 5
    print(ans)
else:
    print(0)

Submission status: Accepted

Solution code:
N = int(input())

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

count = 0
denom = 10

while denom <= N:
  count += N // denom
  denom = denom * 5

print(count)

Submission status: Accepted

Solution code:


from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


def main():
    n = ii()
    ans = 0
    if n%2:
        print(0)
    else:
        tmp = n//2
        while tmp > 0:
            ans+=tmp//5
            tmp//=5

        
        print(ans)

    
main()

Submission status: Accepted

Solution code:
N=int(input())

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

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

Submission status: Accepted

Solution code:
n = int(input())
if n % 2 == 1:
  print(0)
elif n == 0:
  print(0)
else:
  m = n // 2
  l = 1
  ans = 0
  while 5**l <= m:
    ans += m//(5**l)
    l += 1
  print(ans)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if n%2!=0:
    print(0)
else:
    k = 1
    tmp = 1
    ans = 0
    while tmp:
        tmp = n//(2*5**k)
        ans += tmp
        k += 1
    print(ans)

Submission status: Accepted

Solution code:
n=int(input())
if(n%2):
  print(0)
else:
  n=n//2
  ans=0
  for i in range(10000):
    n=n//5
    ans+=n
  print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

    print(sum)

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
sub = 0
if n % 2 == 1:
    print(0)
else:
    n //= 10
    sub+=n
    while n > 0:
        n //= 5
        sub+= n
    print(sub)

Submission status: Accepted

Solution code:
import sys

N = int(input())

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

cnt = 0
x = 10

while True:
    if x>N:
        break
    cnt += N//x
    x *= 5
print(cnt)

Submission status: Accepted

Solution code:
N=int(input())

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

#s=0
#for i in range(2,N+1,2):
#    while(i%5==0 and i!=0):
#        s+=1
#        i=i//5
#print(s)

s=0
t=10
while(N>=t):
    s+=(N//t)
    t*=5
print(s)

#L=len(str(N))-1
#s+=L*(L-1)
#T=N//10
#s+=T
#print(s)

Submission status: Accepted

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
if n % 2 != 0:
    print(0)
else:
    count = 0
    for i in range(1,len(str(n))*2):
        count += n//((5**i)*2)
    print(count)

Submission status: Accepted

Solution code:
N = int(input())

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

x = 1
num2 = 0
while x < N:
    x *= 2
    num2 += N//x

x = 1
num5 = 0
while x < N:
    x *= 5
    num5 += (N//x)//2

ans = min(num2, num5)
print(ans)

Submission status: Accepted

Solution code:
import sys
n = int(input())

if n % 2 != 0:
    print(0)
    sys.exit()

# nの階乗をpで何回割れるか
def solve(n, p):
    if n == 1 or n == 0:
        return 0
    return n//p + solve(n//p, p)

print(solve(n//2, 5))

Submission status: Accepted

Solution code:
n = int(input())

if n%2 == 1:
    print(0)
else:
    ans = 0
    n = n // 10
    while True:
        if n == 0:
            break
        ans += n
        n = n // 5
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())  
if N%2==0: 
  r = 0 
  for i in range(99): 
    r += N // 10 // 5 ** i 
  print(r) 
else: 
  print(0)

Submission status: Accepted

Solution code:
N = int(input())

if N % 2:
  print(0)
else:
  
  num_five = 0
  cursor = 10
  while N // cursor != 0:
    num_five += N // cursor
    cursor *= 5

  num_two = 0
  cursor = 2
  while N // cursor != 0:
    num_two += N // cursor
    cursor *= 2

  print(min(num_five, num_two))

Submission status: Accepted

Solution code:
import numpy as np
def calc(number):
    result = np.log10(number) - np.log10(number) % 1
    return(result)

input_num = int(input())

if(input_num % 2 == 1):
    print(0)
else:
    result_1 = 0
    num = 5
    while(input_num - num >= 0):
        result_1 += (input_num - num) // (num * 2) + 1
        num = num * 5
    num = 5
    result = 0
    while(input_num - num >= 0):
        result += input_num // num
        num = num * 5
    print(result - result_1)

Submission status: Accepted

Solution code:
def pcount(n,p):
    #count degree of p in factorization of n!
    count = 0
    temp = p
    while temp <= n:
        count += n/temp
        temp *= p
    return count

n = int(raw_input())
if n%2 == 1:
  print 0
else:
  print pcount(n/2, 5)

Submission status: Accepted

Solution code:
# 奇数だと0にならない
# 10で割れれば0の数+1だが100とか3400とかそういうのがあるので考える
# 10を2と5に分解する
# 2*(5**i)で割った商 10,50,250,...


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

for i in range(1, 27):  # 5**25 < 10**18 < 5**26
    ans += n // (2 * 5 ** i)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if n % 2 == 1:
	print(0)
else:
	n //= 2
	res = 0
	while n > 0:
		res += n // 5
		n //= 5
	print(res)

Submission status: Accepted

Solution code:
n = int(input())
if n % 2 == 1:
  print(0)
else:
  c = 0
  j = 0
  i = 0
  while j < n:
    j = 10 * (5 ** i)
    c += n // j
    i += 1
  print(c)

Submission status: Accepted

Solution code:
N=int(input())

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

print(ans)

Submission status: Accepted

Solution code:
# 奇数だと0にならない
# 偶数のとき、10とか200とか3450とかのときにそれぞれ1つ、2つ、1つずつ0が増える

# ↑ とかいうのを本番中に考えていたがこれは頭が悪かった 悪すぎたかもしれません
# 10が出ればいいのではなく2と5で割り切れる云々を考えればよかったらしい は？？？？
# 2はどうせたくさんでてくるので5だけ数える
# 5の登場回数なので5の乗数はその数ぶん数える
# 5, 25, 125, 625... で割った商

n = int(input())
ans = 0
if n % 2 == 1:
    print(0)
    exit()
n //= 2  # この帳尻合わせよくわかってない
for i in range(1, 27):  # 5**25 < 10**18 < 5**26
    ans += n // (5 ** i)
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

if n % 2 != 0:
    print(0)
else:
    ans=0
    m=10
    i=1
    while n >= m:
        ans+=n//m
        i+=1
        m=2*5**i
    print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
if n % 2 != 0:
    ans=0
else:
    ans=0
    m=10
    i=1
    while n >= 2*5**i:
        ans+=n//(2*5**i)
        i+=1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
a = 10
cnt = 0
if N % 2 == 0:
    # N is even.
    while a <= N:
        cnt += (N // a)
        a *= 5
    print(cnt)
else:
    # N is odd.
    print(0)

Submission status: Accepted

Solution code:
n = int(input())
x = 10
count = 0
if n % 2 == 0:
    while x <= n :
        count += n // x
        x *= 5
    print(count)
else:
    print(0)

Submission status: Accepted

Solution code:
n=int(input())
if n%2==1:
    print(0)
else:
    n=n//2
    five=1
    ans=0
    while n>=5**five:
        ans+=n//(5**five)
        five+=1
    print(ans)

Submission status: Accepted

Solution code:
n=int(input())
if n%2==1:
    print(0)
else:
    n=n//2
    five=1
    ans=0
    while n>=5**five:
        ans+=(n//(5**five))
        five+=1
    print(ans)

Submission status: Accepted

Solution code:
n=int(input())
if n%2==1:
    print(0)
else:
    n=n//2
    five=1
    ans=0
    while n>=(5**five):
        ans+=(n//(5**five))
        five+=1
    print(ans)