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 main():
    import sys
    input = sys.stdin.readline

    import math
    N = int(input())

    if N % 2 != 0:
        print(0)
        exit()
    else:
        num_zeros = N // 10
        N_head = N//10
        for i in range(1, 25):
            num_zeros += (N_head)//(5**i)
    print(num_zeros)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# n = 1000000000000000000 // 2
def A027868(n):
    return 0 if n < 5 else n // 5 + A027868(n // 5)
# A027868(n) # 124999999999999995

def ABC148E(n):
    if n % 2 == 1:
        print(0)
    else:
        print(A027868(n // 2))

n = int(input())
ABC148E(n)

Submission status: Accepted

Solution code:
N = int(input())

count = 0
if N%2==1:
    print(0)
    exit()
powNum = 1
while 2*pow(5,powNum) <= N:
    count += N//(2*pow(5,powNum))
    powNum+=1
print(count)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(read())
if n % 2 == 1:
    print(0)
    exit()
cnt = 0
n //= 2
while n:
    n //= 5
    cnt += n
print(cnt)

Submission status: Accepted

Solution code:
import fractions


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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n=int(input())

if n%2==1:
    print(0)
else:
    to_search = [2*5**i for i in range(1,30)]
    print( sum(n//s for s in to_search) )

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    if N%2 != 0:
        print(0)
        return
    output = 0
    T = 10
    while N//T > 0:
        output += N//T
        T *= 5
    print(output)
    return

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
if N % 2:
    print(0)
    exit()

ans = 0
n = 10
while N >= n:
    ans += N//n
    n *= 5

print(ans)

# N = 40
# def get(i):
#     if i < 2:
#         return 1
#     return i * get(i-2)
#
# for i in range(N):
#     n = get(i)
#     # print(n)
#     k = n
#     m = 0
#     while n % 5 == 0:
#         m += 1
#         n //= 5
#     print(i, m, k)

Submission status: Accepted

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

Submission status: Accepted

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

x = int(input())
print(0 if x%2 else f(x//2))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
n = int(sys.stdin.readline().rstrip())
if n%2:
    print(0)
else:
    ans = 0
    n //= 10
    while n > 0:
        ans += n
        n //= 5
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
def solve(n):
  if n < 2:
    return 1
  else:
    return n*solve(n-2)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

mul_5 = 0
ans = 0
while n > 2 * 5**mul_5:
    mul_5 += 1
if n % 2 == 0 and mul_5 > 0:
    for i in range(mul_5):
        ans += n // (2 * 5**(i+1))

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
l = len(n)
n = int(n)
import math
if n % 2 == 1:
  print(0)
else:
  c = 0
  for i in range(1, 100):
      c += n // 5**i // 2
  print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
import functools
import math
import scipy
import fractions
import itertools

def solve():
    n = int(input())
    if n % 2 != 0:
        print(0)
    else:
        i = 5
        ans = 0
        while i <= n:
            ans += n // (i*2)
            i *= 5
        print(ans)
    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

cnt = 0

for i in range(26):
  cnt += N // (5 ** (i + 1) * 2)

print(cnt)

Submission status: Accepted

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

ans = 0
i = 1
while n // (2 * 5 ** i) != 0:
    ans += n // (2 * (5 ** i))
    i += 1

print(ans)

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
if N%2 == 1:
  r = 0
  print(r)
  exit(0)
N = N//2
r = 0
for p in range(1025):
  r += N//5
  N = N//5
print(r)

Submission status: Accepted

Solution code:
N=input()
lenN=len(N)
N=int(N)




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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    n=int(input())
    
    if n%2==1:
        print(0)
    else:
        N=n//2
        cnt=0
        while N>=5:
            cnt+=N//5
            N//=5
        print(int(cnt))
        



    
resolve()

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n = int(input())
    if n % 2 != 0:
        print(0)
        exit(0)
    ans = 0
    div = 10
    while n // div:
        ans += n // div
        div *= 5

    print(ans)

Submission status: Accepted

Solution code:

n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

print(res)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n = int(input())
    if n % 2 != 0:
        print(0)
        exit(0)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=int(input())

if n%2==1:
    print(0)
else:
    ans = 0
    memo = []
    bunbo = 10
    while bunbo <= n:
        memo.append(bunbo)
        bunbo *= 5
    for i in memo:
        ans += n//i
    print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

fifth = [5**k * 2 for k in range(1, 36)]

cnt = 0
for fif in fifth:
	cnt += n // fif
	
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

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

if N % 2:
    print(0)
else:
    print(ans)

Submission status: Accepted

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

ans = 0
mul5 = 10
while mul5 <= n:
    ans += n // mul5
    mul5 *= 5
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

def g2(n, p):
    res = 0
    if n % 2 == 1:
        return g1(n, p) - g2(n - 1, p)
    else:
        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:
def main():
    N=int(input())

    if N%2!=0:
        print(0)
        exit()
    
    k=10
    ans=0
    while(k<=N):
        ans+=N//k
        k*=5
    print(ans)
    
if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())

import math

if N % 2 == 1:
    print(0)
elif N == 0:
    print(0)
else:
    half = N // 2
    m = math.floor(math.log(half, 5))
    cnt = 0
    for i in range(m):
        cnt += half // (5 ** (i+1))
    print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque
n = int(input())

if n % 2 == 1:
    print(0)
    exit()
# 10のべき乗の数を数えましょうという問題
divider = 10
keta_count = []
while True:
    count = n // divider
    divider *= 5
    keta_count.append(count)
    if (count == 0):
        break
print(sum(keta_count))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

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

k=5
ans=0
while k*2<=N:
    ans+=N//(k*2)
    k=k*5

print(ans)

Submission status: Accepted

Solution code:
import sys
if __name__ == "__main__":
    n = int(input())
    if n % 2 == 1:
        print(0)
        sys.exit(0)

    base = 5

    ans = 0

    while True:
        tmp = n // base
        if tmp == 0:
            break

        ans += tmp // 2
        base *= 5
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
keta = 0
if N % 2 == 1:
    print(ans)
else:
    i = 10
    SUM = 0
    for _ in range(100):
        SUM += N // i
        i *= 5
    print(SUM)

Submission status: Accepted

Solution code:
n = int(input())
if n % 2:
    print(0)
else:
    n //= 10
    ans = n
    while n:
        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:
        ans += n//5
        n //= 5
    print(ans)

Submission status: Accepted

Solution code:

import sys
sys.setrecursionlimit(1000000)

n = int(input())


def calc(n, p):
    if n < p:
        return 0
    else:
        return n//p + calc(n//p, p)


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

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
x = 1
if N <= 1 or N % 2 == 1 :print(0)
else:
    while pow(5,x) <= N:
        ans += N // 2 // pow(5,x)
        x += 1
    print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
N=int(input())

ans=0
if N%2==0:
    for i in range(18):
        ans+=N//(10*10**i)
    for i in range(100):
        for j in range(100):
            ans+=N//(50*5**i*10**j)-N//(100*5**i*10**j)
    print(ans)
    
    
else:
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
if N % 2:
    print(0)
    exit()
ans = 0
x = 1
while pow(5, x) <= N:
    ans += N // 2 // pow(5, x)
    x += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

    print(cnt)

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math

    #inf = 10**17
    #mod = 10**9 + 7

    n = int(input())
    if n%2 == 1:
        print(0)
    else:
        res = 0
        base = 10
        while base <= n:
            res += n//base
            base *= 5
        print(res)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    if n%2==0:
        ans=0
        i=0
        while 10*5**i<=n:
            ans+=n//(10*5**i)
            i+=1
        print(ans)
    else:print(0)

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
i = 5
ans = 0
if N %2 == 0:
    for j in range(10**8):
        num = N//(i*2)
        if num == 0:
            break
        else:
            ans += num
            i = i*5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc148/tasks/abc148_e

n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
if n % 2 == 1:
    print(0)
    exit()
elif n % 2 == 0:
    ans = n//10
    kar = n//10
    while True:
        if kar // 5 >= 1:
            ans += kar // 5
            kar = kar// 5
        elif kar // 5 < 1:
            break
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if (n % 2 == 1):
    print(0)
else:
    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 == 1:
    print(0)
else:
    ans = 0
    div = 10
    while div <= n:
        ans += n // div
        div *= 5
    print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())

if N % 2 != 0:
  print(0)
else:
  answer = 0
  i = 0
  j = 1
  while j > 0:
    a = math.floor(N // (10 * (5 ** i)))
    if a == 0:
      print(answer)
      break
    else:
      answer += a
      i += 1

Submission status: Accepted

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

k = 10
ans = 0

while(N >= k):
    ans += N//k
    k *= 5

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
i = 0
while True:
    if n%2 == 1:
        break
    i += 1
    ans += n//2//(5**i)
    if n//2//(5**i) == 0:
        break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
if n % 2 != 0:
    print(0)
else:
    div = 5
    ans = 0
    while n >= div:
        ans += n // (2 * div)
        div *= 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 == 1:
    print(0)
    exit(0)
t = 0
ans = 0
while 5**(t+1) <= N:
    t += 1
    ans += N//(2*(5**t))
print(ans)

Submission status: Accepted

Solution code:
###### Importing Libraries ######
import math
import operator as op
from functools import reduce
from fractions import Fraction as frac
#################################
##### User defined function #####

############ NCR ###############
def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom
    
############ READ ###############
def rd(p):
    if(p==0):
        return input()
    if(p==1):
        return int(input())
    if(p==2):
        return map(int,input().split())
    if(p==3):
        return list(map(int,input().split()))


############ DSU ###############
global par
par=[-1 for i in range(100001)]
# t=rd(1)
def find(u):
    if(par[u]<0):
        return u
    else:
        return find(par[u])
def uni(x,y):
    u=find(x)
    v=find(y)
    if u==v:
        return
    if(par[u]<par[v]):
        par[u]+=par[v]
        par[v]=u
    else:    
        par[v]+=par[u]
        par[u]=v
################################        
        

t=1
for term in range(1,t+1):
    n=rd(1)
    div=10
    tot=0
    if n%2==1:
        print(0)
    else:    
        while(n>=div):
            # print(n//div)
            tot+=(n//div)
            div*=5
        print(tot)

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
ans = 0
N = int(input())
if N % 2 == 1:
    print(0)
else:
    N = N /2
    while N >= 5:
        ans += N // 5
        N = N // 5
    print(int(ans))

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
if n%2 == 0:
    pre = 0
    for i in range(32,0,-1):
        ct = n//(5**i*2)
        ans += i*(ct-pre)
        pre = ct

print(ans)

Submission status: Accepted

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


def solve(N: int):
    if N %2 ==1:
        print(0)
        exit()
    else:
        sum = 0
        digit = 1
        while 5**digit*2 <= N:
            sum += N//(5**digit*2)
            digit+=1
        print(sum)
    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:
import math  # noqa
import bisect  # noqa
import queue  # noqa


if __name__ == '__main__':
    N = int(input())
    if N % 2 == 0:
        ans = N // 10
        d = 50
        while N // d > 0:
            ans += N // d
            d *= 5
        print(ans)
    else:
        print(0)

Submission status: Accepted

Solution code:
N = int(input())
n = N // 10
lista = []

while n != 0:
    lista.append(n)
    n //= 5
print(sum(lista) if N % 2 == 0 else 0)

Submission status: Accepted

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

a = n
cnt = 0
i = 1
while True:
    if a >= 2*5**i:
        cnt += a//(2*5**i)
        i += 1
    else:
        break
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
if n%2!=0:
    print(0)
else:
    f=[]
    five=10
    for i in range(27):
        x=n//five
        f.append(x)
        five*=5
    f2=[]
    for i in range(26):
        f2.append(f[i]-f[i+1])
    ans=0
    for i in range(26):
        ans+=(i+1)*f2[i]
    print(ans)

Submission status: Accepted

Solution code:
#coding:utf-8
import sys,os
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7


    def countZero(n):
        return len(str(n))-len(str(n).rstrip('0'))
    
    def f(n):
        if n < 2:
            return 1
        else:
            n2 = f(n-2)
            if n % 10 != 0 and countZero(n2) != countZero(n2*n):
                print(n,n2)
            return n * n2
    N = II()
    # fn = f(N)
    # print(fn)
    # print(countZero(fn))
    if N % 2 == 1:
        print(0)
        return
    else:
        ans = 0
        b = 10
        while (N-b)//b +1 > 0:
            ans += (N-b)//b +1
            b *= 5
        print(ans)
        # 10,20,30,40,50,100,110,200,1000,1010,1100,1200
        #50,150,250,950,1050,
        #250,750,1250
        #1250,2750
        return
if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

    zero_count = 0

    i = 10
    while n // i != 0:
        zero_count += n // i
        i *= 5

    print(zero_count)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
b = True
k = 0 #カウント用
i = 0
if n == 0:
    print(0)
elif n % 2 == 1:
    print(0)
else:
    while n // (10  * (5 ** i)) > 0:
        k += n // (10 * (5 ** i))
        i += 1
    print(k)

Submission status: Accepted

Solution code:
N = int(input())
if N%2==1:
    print(0)
else:
    num = 1
    while N>=5**num:
        num += 1
    num -= 1
    answer = 0
    for i in range(1,num+1):
        answer += N//(2*5**i)
    print(answer)

Submission status: Accepted

Solution code:
N = int(input())
if N % 2 == 1:
    print(0)
    quit()
N //= 2
res = 0
i = 0
while (5 ** i) <= N:
    #print(N)
    i += 1
    res += N // (5 ** i)
print(res)

Submission status: Accepted

Solution code:
n = int(input())

ret = 0
waru = 10

if n % 2 == 1:
    print(0)
    exit()
else:
    while n >= waru:
        ret += n // waru
        waru *= 5

print(ret)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


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

    def F(N):
        if N & 1:
            return 0
        N //= 2
        x = 0
        while N:
            N //= 5
            x += N
        return x

    answer = F(N)
    print(answer)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


def main():
    N = int(input())
    if N < 2:
        print(0)
        return
    if N % 2 == 1:
        print(0)
        return
    n = 2
    cnt = 0
    while n * 5 <= N:
        n *= 5
        cnt += 1
    ans = 0
    for _ in range(cnt):
        ans += N // n
        n //= 5
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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