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:
import math
import bisect
import collections
import itertools
def gcd(a,b):return math.gcd #最大公約数
def lcm(a,b):return (a*b) // math.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def imn(): return map(int, input().split()) #整数map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def 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)
    return divisors
def is_prime(n):
    if n == 1: return False
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0: return False 
    return True

N = iin()
if N % 2 == 1: 
    print(0)
    exit()
cnt = 0
div = 10
while True:
    cnt += N//div
    div *= 5
    if div > N:break

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
if n&1:
  print(0)
else:
  val = 10
  cnt = 0
  while val <= n:
    cnt += n//val
    val *= 5
  print(cnt)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding:utf-8 -*-

def main(n):
  if n%2 != 0:
    # odd
    return 0
  else:
    # even
    count_5 = 0
    for i in range(1, 100):
      denominator = (5**i)*2
      if n < denominator:
        break
      count_5 += (n // denominator)
    return count_5

if __name__=='__main__':
  n = int(input())
  print(main(n))

Submission status: Accepted

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

N = int(input())

if N%2 != 0 : 
    global_cnt = 0
else : 
    n = 1
    while 2*(5**n) <= N : 
        n += 1
        
    global_cnt = 0
    
    for i in range(1, n) : 
        local_cnt = N // (2*(5**i))
        global_cnt += local_cnt
        
print(global_cnt)

Submission status: Accepted

Solution code:
N = int(input())
#= map(int,input().split())
#a =list(map(int,input().split()))
# [list(map(int,input().split())) for i in range(N)]
waru = 50
answer = N//10
if N%2 ==0:
    while N >=waru:
        answer += N//waru
        waru *= 5
    print(answer)
else:
    print('0')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
a = 1
if N%2==0:
  while True:
    b = N//(5**a*2)
    if b==0:
      break
    a+=1
    ans+=b
  print(ans)
else:
  print(0)

Submission status: Accepted

Solution code:
import math


def run(N):
    if N == 0:
        return 0
    ans = 0
    if N % 2 == 0:
        for i in range(int(math.log(N, 5))):
            ans += N // (10 * (5**i))
    return ans


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(input())
ans = 0
if n % 2 == 1: 
    print(0)
    exit
else: 
    while n != 0:
        ans += n//10
        n //= 5
    print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

cnt = n // 10
n //= 10

while n != 0:
    cnt += n // 5
    n //= 5

print(cnt)

Submission status: Accepted

Solution code:
from sys import exit

N = int(input())
if N < 2:
    F = 1
    print(0)
    exit()
elif N % 2 == 1:
    print(0)
    exit()
else:
    t = 10
    result = 0
    while t <= N:
        result += N // t
        t = t * 5
print(result)

Submission status: Accepted

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

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

Submission status: Accepted

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

def count_2(num):
    return format(num, 'b')[::-1].find('1')

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

Submission status: Accepted

Solution code:
n = int(input())

a = 0
i = 1

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

print(a)

Submission status: Accepted

Solution code:
def solve(n):
    if n % 2 == 1:
        return 0
    else:
        x = sum(n // (10**i) for i in range(1, 20))
        x += sum(n // ((5**i) * 10) for i in range(1, 100))
        x -= sum(n // ((10**i) * 10) for i in range(1, 100))
        return x

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

Submission status: Accepted

Solution code:
n=int(input())
if n%2==0:
    m=n//2
    ans=[]
    p=1
    while p!=0:
        p=m//5
        ans.append(p)
        m=p
    print(sum(ans))
else:
    print(0)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
x = 10

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

while x <= n:
    ans += n // x
    x *= 5

print(ans)

Submission status: Accepted

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

if n%2 == 0:
    while n//frc:
        ans += n//frc
        frc *= 5
print(ans)

Submission status: Accepted

Solution code:
import sys
n = int(input())
if n % 2 == 1:
    print(0)
    sys.exit()
x = 10
y = 0
while x <= n:
    y += n // x
    x *= 5
print(y)

Submission status: Accepted

Solution code:
N = int(input())

ans=0

def calc(N,ans):
    M = N //5
    ans += M
    
    if M < 5:
        return ans
    else :
        return calc(M,ans)
    
if N%2 != 0:
    ans = 0
else:
    ans=calc(N//2,ans)
        
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
if n % 2 == 1:
 print(0)
else:
 i = 10
 ans = 0
 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:
  cnt = 0
  ans = 0
  for i in range(n):
    if n>= 2*(5**(i+1)):
      cnt += 1
    else:
      break
  
  for j in range(cnt):
    ans += n//(2*(5**(j+1)))
  print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
from math import ceil
from math import factorial
from collections import Counter
from operator import itemgetter
import bisect
ii = lambda: int(input())
iia = lambda: list(map(int,input().split()))
isa = lambda: list(input().split())
def gcd(a,b):
	if(b==0):
		return a
	return gcd(b,a%b)

n = ii()

if(n%2==1):
	print(0)
else:
	x = len(str(n))
	a = []
	i = 10
	while(i<=n):
		a.append((n//i))
		i*=5
	print(sum(a))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def inp():
 return [int(x) for x in input().split()]

def z(n):
  if n%2==1:
    return 0

  s = n//10

  d = 50
  while d<=n:
    s += n//d
    d *= 5
  return s

N = int(input())
print(z(N))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

if not n%2 == 0:
  print(0)
else:
  ans = 0
  div = 5
  while n//div > 0:
    ans += (n//div)//2
    div *= 5
    
  print(ans)

Submission status: Accepted

Solution code:
import math

def main():
  N = int(input())
  count = 0
  if N%2==1:
    print(count)
    return
  for i in range(1,50):
    count += N//(2*(5**i))
  print(count)
  return

if __name__=="__main__":
  main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

N = int(input())

def z(n):
    if n < 2:
        return 0
    elif n % 2 == 1:
        return 0
    else:
        m = n // 2
        return f(m)

def f(m):
    if m < 5:
        return 0
    a = m // 5
    return a + f(m // 5)
    
        
print(z(N))

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys

def main():

    # sys.stdin=open('input148e.txt')

    n = int(input())
    c = 0

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

    r = 10
    while r <= n:
        c += n // r
        r = r * 5
    print(c) 

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

if n%2 or n < 10:
    print(0)
    exit()

ans = 0
cnt = 1
while 2*(5**cnt) <= n:
    ans += n//(2*(5**cnt))
    cnt+=1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
if N % 2 == 1:
	print("0")
else:
	a = 5
	cnt = 0
	while a <= N:
		cnt += N // (a * 2)
		a *= 5
	print(cnt)

Submission status: Accepted

Solution code:
print(sum([0 if n%2==1 else n//2//d for n,d in zip([int(input())]*29,[5**i for i in range(1,30)])]))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.buffer.readline

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

	if N%2:
		print(0)
		return

	res = 0
	while N:
		res += N//10
		N //= 5
	print(res)

main()

Submission status: Accepted

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

Submission status: Accepted

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

    # f(n) = 1 (n < 2)
    # f(n) = n * f(n - 2)
    # f(n) = n * (n - 2) * (n - 4) * ... * 4 * 2

    if (N % 2 == 0):
        c = 0
        a = 5
        while 2 * a <= N:
            c += N // (2 * a)
            a *= 5
        print(c)

    else:
        print(0)


main()

Submission status: Accepted

Solution code:
N = int(input())

ret = 0

if N % 2 != 0:
   print '{}'.format(ret)

else:
    N //= 2
    while N > 0:
        N //= 5
        ret += N
    print '{}'.format(ret)

Submission status: Accepted

Solution code:
n = int(input())


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

Submission status: Accepted

Solution code:
def solve():
    N = int(input())

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

if __name__ == '__main__':
    solve()

Submission status: Accepted

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

ans = 0

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

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
a = 1
if n % 2 == 1:
    print(0)
else:
    for j in range(1,40):
        ans += (n // ((5**j)*10))
    n10 = n // 10
    print(ans+n10)

Submission status: Accepted

Solution code:
import math
import sys
from collections import defaultdict
from itertools import product, permutations, combinations

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]


N = int(input())
if N % 2:
    print(0)
    exit()
else:
    N //= 2

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

Submission status: Accepted

Solution code:
import math

N = int(input())
a = int(list(str(N))[-1])

if N % 2 == 1:
	print(0)
else:
	par = 5
	ctr = 0
	while par <= N:
		ctr += ((N - a) // par) // 2
		par *= 5
	print(ctr)

Submission status: Accepted

Solution code:
N = int(input())

def solve(n):
    if n%2 == 1:
        return 0
    sum_num = 0
    for i in range(1000):
        m = n//2 // (5**(i+1))
        if m == 0:
            break
        sum_num += m
        # print(m)
    return sum_num

print(solve(N))

Submission status: Accepted

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

import math

N = int(input())

init, tmp, ans = N // 10, 50, 0
if N % 2 == 0:
    while True:
        if N // tmp > 0:
            ans += N // tmp
            tmp = tmp * 5
        else:
            break
    print(init + ans)
else:
    print(0)

Submission status: Accepted

Solution code:
n = int(input())

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

n //= 2

ans = 0
while n:
    n //= 5
    ans += n

print(ans)

Submission status: Accepted

Solution code:
import math
n = int(input())
if n % 2 == 1:
    print(0)
    exit()
else:   
    ten_list = []
    five = 5
    while five*2 <= n:
        ten_list.append(five*2)
        five = five * 5
    count = 0
    for f in ten_list:
        count += n//f
    print(int(count))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = int(input())

result = 0

if num  % 2 != 0:
    result = 0
else:
    num = num // 2
    while(num > 0):
        result += num // 5
        num = num // 5

print(result)

Submission status: Accepted

Solution code:
n = int(input())
init = 10
res=0
if(n%2==0):
    while init <= n:
        res += n//init
        init*=5

print(res)

Submission status: Accepted

Solution code:
N=int(input())
if N%2==1:
    print(0)
else:
    M=N//2
    #(M!)が5で何回われるか
    ans=0
    while(M>0):
        ans+=M//5
        M=M//5
    print(ans)

Submission status: Accepted

Solution code:
import math
n = int(input())
ans = 0
if n == 0 or n % 2 == 1:
    pass
else:
    lo = int(math.log(n, 5)) + 1
    for i in range(1, lo):
        ans += n // (5 ** i) // 2
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = 0

if n % 2 != 0 or n < 10:
  print(0)
else:
  i = 10
  while i <= n:
    a += n//i
    i *= 5
  print(a)

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 1 << 100
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
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 LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n = I()

if n % 2 == 0:
    ret = 0
    a = n // 10
    ret += a
    while a:
        a //= 5
        ret += a
    print(ret)
else:
    print(0)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
def g(N):
    if N%2 == 1:
        return 0
    res = 0
    N//=2
    while N >= 5:
        res += N//5
        N //= 5
    return res
print(int(g(int(input()))))

Submission status: Accepted

Solution code:
import sys
n=int(input())
d=10
a=0
if n%2!=0:
  print(0)
  sys.exit()

while n>=d:
  a+=n//d
  d*=5

print(a)

Submission status: Accepted

Solution code:
N = int(input())
count = 0
k = 5

if N % 2 == 0:
    n = (N // 2 // 5) * 5
    while(n >= k):
        count += n // k
        k *= 5

print(count)

Submission status: Accepted

Solution code:
n = int(input())

t = 0
order = 10
index = 0

if n % 2 == 0:
  
  while n / order >= 1:
    order *= 5
    index += 1
    
  for i in range(index):
    t += n//(10*5**i)

print(t)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
count = 0
if N%2 == 0:
    N //= 2
    while N > 0:
        count += N//5
        N //= 5
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

print(ans)

Submission status: Accepted

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

  print(s)

Submission status: Accepted

Solution code:
# データ読み込み

import sys
from collections import deque

def input_data(d=""):
  t = sys.stdin.read()
  if t:
    return t
  else:
    if d[0] == "\n":
      d = d[1:]
    if d[-1] == "\n":
      d = d[:-1]    
    return d

A, *B  = map(int,input_data().split())

def aaa(k):
  k = int(k)
  if A == k:
    if A % 2 == 1:
      return 0
    k = int(k // 2)
  if k == 0:
    return 0
  return int(k//5) + aaa(k//5)

def bbb(k):
  k = int(k)
  if A == k:
    if A % 2 == 1:
      return int(0)
    k = int(k / 2)
  if k == 0:
    return 0
  return int(k/2) + bbb(k/2)

print(min([aaa(A)]))

Submission status: Accepted

Solution code:
import decimal
N=decimal.Decimal(int(input()))
if N%2==1:
    print(0)
else:
    five=decimal.Decimal(5)
    ans=decimal.Decimal(0)
    while(five<N):
        ans+=N//decimal.Decimal(five)//decimal.Decimal(2)
        five*=decimal.Decimal(5)
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

if N % 2 == 0:
    mod = 10
    while N >= mod:
        ans += N // mod
        mod *= 5

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

if n % 2 == 1:
  print(0)
else:
  t = n // 10
  r = 0

  while t > 0:
    r += t
    t //= 5

  print(r)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
if N % 2 == 1:
    print(0)
else:
    N = N//2
    d = 5
    sum = 0
    while True:
        if N // d == 0:
            break
        else:
            sum = sum + (N // d)
            d = d * 5
    print(sum)

Submission status: Accepted

Solution code:
#148e
N = int(input())

if N%2 == 0:
    ans = 0
    
    for i in range(1,28):
        a = (5**i)*2
        b = N//a
        #print(i,a,b)

        if a > N:
            break

        ans += b
else:
    ans = 0
    
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if n & 1:
    print(0)
else:
    ans = 0
    cur = 2
    for i in range(50):
        cur *= 5
        ans += n // cur
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
ans = 0
if N % 2 != 0:
    print(ans)
else:
    for i in range(1,27):
        a = N // (2*(5**i))
        ans += a
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

cnt = 0
n = 1

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

Submission status: Accepted

Solution code:
# 2 * 5 = 10 なので、
# Nまでの偶数を順番に素因数分解して、そこで素因数として登場する 5 の合計が答えになる
# 2 はたくさんあるので、気にしなくていい。
# 素因数に 5 が出てくるのは 2+2+2+2+2 = 2*5 = 10 の時なので、偶数5回ごとに 5 は出てくる。
# さらに、10*5 = 50 の時には 5 が2回出てくる。
# なので、N を 5 で割って（切り捨て）、さらにその数を 5 で割って、と繰り返して合計を求める
N=int(input())
ans = 0
if N%2 == 1:
    print(0)
else:
    N //= 2
    while N > 0:
        N //= 5
        ans += N
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
#input
N = int(input())

#output
answer = 0
if N % 2 == 1:
    answer = 0
else:
    for i in range(1, 2*len(str(N))):
            answer += N//(5**i*2)
print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# E - Double Factorial

N = int(input())

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

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

print(m)

Submission status: Accepted

Solution code:
import math
N=int(input())
a=0
b=10
if N%2!=0:
	print(0)
else:
	while N>=b:
		a+=(N//b)
		b=b*5
	print(a)

Submission status: Accepted

Solution code:
# E - Double Factorial
N = int(input())
if N % 2 == 1:
    print(0)
else:
    ans = 0
    tmp = 10
    while N >= tmp:
        ans += N // tmp
        tmp *= 5
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())
l = len(str(N))
ans = 0
i = 1
while 2*5**i <= N:
    ans += N//(2*5**i)
    i+=1
print(ans if N%2==0 else 0)

Submission status: Accepted

Solution code:
N = int(input())

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

print(count)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

if n % 2 == 1:
  print(0)
elif n < 10:
  print(0)
else:
  count = 2
  while n >= 2 * (5 ** count):
    count += 1
  result = 0
  for i in range(count - 1):
    result += n // (2 * (5 ** (i + 1)))
  print(result)

Submission status: Accepted

Solution code:
"""
a=[0]*(n)
for i in range(n):
    if(i<2):
        a[i]=1
    else:
        a[i]=i*a[i-2]
for i in range(n):
    print(i,a[i]))
"""

def cal(n):
    res=0
    while(n>0):
        res+=n//5
        n//=5
    return res

n=int(input())
if(n==0):
    print(0)
elif(n%2==1):
    print(0)
else:
    print(cal(int(n//2)))

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

Solution code:
def func(n):
    ans = 0
    div = 10
    while div <= n:
        ans += n//div
        div *= 5
    return ans

N = int(input())
if N&1 == 1:
    print(0)
    exit()
print(func(N))

Submission status: Accepted

Solution code:
N = int(input())
if N % 2 == 1: 
  print(0)
else:
  k = 25
 
  count = 0
  for i in range(k):
    count += N // ((5**(k-i)) * 2)
 
  print(count)

Submission status: Accepted

Solution code:
N = int(input())

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

ans = 0

denom = 10
while True:
    if denom > N:
        break

    ans += N//denom
    denom = denom*5

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

ans = 0
n //= 2
while n > 0:
    n //= 5
    ans += n

print(ans)

Submission status: Accepted

Solution code:
N = int(input())


def func(x):
    n = x
    if n < 5:
        return 0
    if n % 2 == 0:
        cnt = 0
        i = 1
        n = n // 2
        while 5 ** i <= x:
            n = n // 5
            cnt += n
            i += 1

        return cnt

    else:
        return 0


print(func(N))

Submission status: Accepted

Solution code:
x=int(input())
c=0
if x%2==1:
    print(0)
else:    
    s=0
    l=1
    j=10
    while j<=x:
        s+=(x//j)
        #s+=(x//p)//2
        j*=5
        
    print(s)    
    #print(s+(x//50)//2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
Ans = 0
K = N//2

if N%2 == 1:
    Ans = 0

else:
    while K//5 >0:
        Ans += K//5
        K = K//5
print(Ans)

Submission status: Accepted

Solution code:
#coding:utf-8
n = int(input())
if (n%2==1):
    print (0)
    exit()
n//=2
ls_p = []
p = 5
while(p<10e+18):
    ls_p.append(p)
    p*=5
#print (ls_p)
print (sum([n//p for p in ls_p]))

Submission status: Accepted

Solution code:
N=int(input())

c=0
if N%2==0:
  m=10
  while N//m>0:
    c+=N//m
    m*=5

print(c)

Submission status: Accepted

Solution code:
import math
n=int(input())
ans=0
if n==0 or n%2==1:
    print(ans)
else:
    m=math.ceil(math.log(n, 5))
    for i in range(1, m):
        ans +=(n//2)//(5**i)
    print(ans)

Submission status: Accepted

Solution code:
n=int(input())
an=0

if n%2==1:
    print("0")
    exit()
    
for i in range(1,50):
    an+=(n//((5**i)*2))

print(an)

Submission status: Accepted

Solution code:
# coding: utf-8
import re
import math
import fractions
import numpy as np

def C(n,a):
    if(n==0):return 0
    else:
        return n//a+C(n//a,a)

#main
n=int(input())
if(n%2==1):
    print(0)
else:
    print(C(n//2,5))

Submission status: Accepted

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

import sys
input = sys.stdin.readline

def main():
    N = int(input())
    
    # 奇数は終わる
    if N%2:
        print('0')
        quit()
    
    def calc(x,ans):
        fl = 2*(5**x)
        if N >= fl:
            ans += N//fl
            return calc(x+1,ans)
        else:
            return ans
    
    print(calc(1, 0))
        
    
    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
count = 0
mul = 10

if (N % 2) == 0:
    while True:
        count += N // mul
        mul *= 5
        if mul > N: break
    print(count)
else:
    print(0)

Submission status: Accepted

Solution code:
def answer(n):
  if n % 2 == 1:
    return 0
  else:
    ans = 0
    A = 10
    while n >= A:
      ans += n // A
      A *= 5
    return ans  

print(answer(int(input())))

Submission status: Accepted

Solution code:
#参考
#https://atcoder.jp/contests/abc148/submissions/9105497

import sys

n = int( input() )

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:
  print(0)
else:
  p=n//2
  l=0
  while p>0:
    l+=p//5
    p//=5
  print(l)

Submission status: Accepted

Solution code:
n = int(input())
if n % 2 == 1 or n < 2:
    print(0)
else:
    l, i = 0, 1
    while (n // 2) // 5**i != 0:
        l += (n // 2) // 5**i
        i += 1
    print(l)

Submission status: Accepted

Solution code:
n = int(input()
        )


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
from functools import lru_cache


@lru_cache()
def cal(x):
    if x & 1 or x == 0:
        return 0
    else:
        now = (x // 10) * 10
        now //= 5
        return now // 2 + cal(now)


n = int(input())
print(cal(n))

Submission status: Accepted

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