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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
if N % 2 == 1 :
    print(0)
else:
    if N < 9 :
        print(0)
    else :
        ans = 0
        p = 1
        N = N // 2
        # 偶数の中から5で割れる数を数える
        while True :
            if (N // (5 ** p)) ==  0 :
                break
            else:
                q = N // (5 ** p)
                ans += q
                p += 1
        print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

N = int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

p = 5
tmp = 0
o = n
n //= 2

while n > 1:
    tmp += n // p
    n = n // p

if o % 2 == 0:
    print(tmp)
else:
    print(0)

Submission status: Accepted

Solution code:
# 2019/12/23

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

Submission status: Accepted

Solution code:
n = int(input())

def g(n, x):
    f = 1 if x == 2 else 2
    if n == 0:
        return 0
    else:
        return g(n // x, x) + n // x // f

if n % 2 != 0:
    print(0)
else:
    print(min(g(n, 2), g(n, 5)))

Submission status: Accepted

Solution code:

n = int(input())

def g(n, x):
    cnt = 0
    while True:
        n = n // x
        if x == 2:
            cnt += n
        else:
            cnt += n // 2
        if n == 0:
            break
    return cnt

if n % 2 != 0:
    print(0)
else:
    print(min(g(n, 2), g(n, 5)))

Submission status: Accepted

Solution code:
n = int(input())

def g(n, x):
    cnt = 0
    while True:
        n = n // x
        cnt += n // 2
        if n == 0:
            break
    return cnt

if n % 2 != 0:
    print(0)
else:
    print(min(g(n, 2), g(n, 5)))

Submission status: Accepted

Solution code:
n = int(input())

def func(n):
    if n % 2 != 0:
        return 0

    n_half = n//2
    count = 0

    i = 1
    while 5**i <= n_half:
        count += n_half // 5**i
        i += 1

    return count


print(func(n))

Submission status: Accepted

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

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

from fractions import gcd

n = int(input())
#a = [int(i) for i in readline().split()]

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

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

Submission status: Accepted

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

if N % 2 != 0:
    print(0)
    exit()
P = 1
k = 2 * 5

while k <= N:  
    count += N//k
    k *= 5
    
print(count)

Submission status: Accepted

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


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

    def f(n):
        if n < 2:
            return 1
        else:
            return n * f(n - 2)

    def count_tail_zero(s):
        cnt = 0
        for i in range(len(s) - 1, 0, -1):
            if s[i] == '0':
                cnt += 1
            else:
                break
        return cnt

    print(count_tail_zero(str(f(N))))


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

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

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

    print(ans)


if __name__ == "__main__":
    correct()

Submission status: Accepted

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

n = int(input())

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

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
n2 = N % 2
if n2 != 0:
  ans = 0
elif N <= 2:
  ans =0
else:
  a = int(np.log(N) // np.log(5))
  A = [N // (2 * (5 ** (i + 1))) for i in range(a)]
  ans = np.sum(A)
print(ans)

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
na = lambda: list(map(int, stdin.readline().split()))
ni = lambda: int(ns())

n = ni()

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

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

Submission status: Accepted

Solution code:
n = int(input())
p = 1
count = 0
while (2*5**p <= n):
    count += n//(2*5**p)
    p+=1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#10で割ったあとの個数に注目して解を出してる
N = int(input())

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

def duble_factorial(n, p):
    if n%2 == 1:
        return factorial(n,p) - duble_factorial(n-1, p) # n!! = n!/(n-1)!!だからpで割ると引き算で表せるよね
    else:
        res = factorial(n//2, p)
        if p == 2: 
            res += n//2
        return res

ans = min(duble_factorial(N,2), duble_factorial(N,5))
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

def duble_factorial(n, p):
    if n%2 == 1:
        return factorial(n,p) - duble_factorial(n-1, p) # n!! = n!/(n-1)!!だからpで割ると引き算で表せるよね
    else:
        res = factorial(n//2, p)
        if p == 2: 
            res += n//2
        return res

ans = min(duble_factorial(N,2), duble_factorial(N,5))
print(ans)

Submission status: Accepted

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

if (n //2) *2 != n:
    print(ans)
else:
    n = n // 2
    while n >= 5:
        n = n // 5
        ans += n

    print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int):

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

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

    return



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:
n = int(input())
def calc(n):
    ans = 0
    while n > 0:
        ans += (n//5)
        n //= 5
    return ans

if (n & 1): print(0)    
else: print(n//10 + calc(n//10))

Submission status: Accepted

Solution code:
N = int(input())

def p_adic_valuation_factorial(n, p):
    result = 0
    pow_p = p
    while n >= pow_p:
        result += n // pow_p
        pow_p *= p
    return result

if N % 2 == 0:
    e2 = N // 2 + p_adic_valuation_factorial(N // 2, 2)
    e5 = p_adic_valuation_factorial(N // 2, 5)
    result = min(e2, e5)
else:
    result = 0
print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

ans = 0

N = N // 2

while True:
    if N == 0:
        break
    ans += N // 5
    N = N // 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

def fact(n, x, ans):
    if x > n:
        return ans
    else:
        ans +=  math.floor(n//(2*x))
        return fact(n, x*5, ans)

if n%2:
    print(0)
else:
    print(fact(n, 5, 0))

Submission status: Accepted

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

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-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 I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()

  if n%2!=0:
    return 0

  a=5
  ans=0
  while True:
    if a*2>n:
      return ans
    ans+=n//(a*2)
    a*=5

# main()
print(main())

Submission status: Accepted

Solution code:
n=int(input())
if n%2:print(0);exit()
n//=2
a,m=1,-1
while a<=n:
  a*=5;m+=1
ans=0
for i in range(m):
  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(25):
        ans += ( N // 2 )//( 5 ** ( i + 1 ) )
print( int( ans ) )

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
num = 10

if N % 2 == 0:
    while num <= N:
        ans += N // num
        num = num * 5

print(int(ans))

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import math
import datetime
import itertools
import sys
import copy

# 入力
#N = int(input())
#S = str(input())
#N, A, B = map(int, input().split())
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int( input() )

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

import math    
ct = 0

M = N // 2
for i in range( math.ceil( math.log(M, 5) ) ) :
   if M >= 5**(i+1) :
      ct += M // ( 5**(i+1) )

print(ct)

Submission status: Accepted

Solution code:
n=int(input())

if n<=6:
    print(0)
else:
    if n%2==0:
        n2=(n//10)*10
        i=1
        c_of_5=0 
        while 5**i <= n2:
            c_of_5+=n2//((5**i)*2)
            i+=1
        print(c_of_5)
    else:
        print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

if N & 1:
    print(0)
else:
    k = 10
    ans = 0
    while k <= N:
        ans += N // k
        k *= 5
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

if n%2!=0:
    print(0)
    exit()
else:
    m = n//2
    count = 0
    for i in range(1,30):
        p = 5**i
        count += m//p
    print(count)
    exit()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
def counter(n):
    point = 0
    s = str(n)
    keta = len(s)
    if keta == 1:
        return 0
    if n%2 == 1:
        return 0
    else:
        i = 1
        while True:
            point += n//(2*5**i)
            i += 1
            if n//(2*5**i) == 0:
                break
        return point
print(counter(n))

Submission status: Accepted

Solution code:
def resolve():
    N=int(input())
    c=0
    if N %2 ==1:
        print(0)
        return
    N//=10
    c=N
    while N!=0:
        N//=5
        c+=N
    print(c)
 
 
 
 
 
if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
n = int(input())

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

    ans = x
    print(ans)

Submission status: Accepted

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

n = int(input())

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

ans = 0
base = 1
while True:
    base *= 5
    even = base * 2
    if n < even:
        break
    ans += n // even

print(ans)

Submission status: Accepted

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()

A = []
i = 1
while 5 ** i * 2 <= INF:
    A.append(5**i * 2)
    i += 1

if N % 2 == 0:
    ans = 0
    for a in A:
        ans += N // a
    print(ans)
else:
    print(0)

Submission status: Accepted

Solution code:
N = int(input())
if N % 2 == 1:
    print(0)
else:
    N //= 2
    print(sum(N // pow(5, j) for j in range(1, 30)))

Submission status: Accepted

Solution code:
N = int(input())
"""
f = [0]*(N + 1)
f[0] = 1
f[1] = 1
for i in range(2, N + 1):
    f[i] = i * f[i - 2]

count = 0
while f[N] % 10 == 0:
    count += 1
    f[N] = f[N] // 10
    #print(count, f[N])

print(count)
"""
if N % 2 == 1:
    print(0)
if N % 2 == 0:
    five_count = 0
    while N >= 5**five_count:
        five_count += 1
    
    num_5 = list()
    for i in range(1, five_count + 1):
        num = N // (5**i)

        num_5.append(num//2)
        
    sum_5 = sum(num_5)
    print(sum_5)

Submission status: Accepted

Solution code:
n=int(input())
if n%2==1:
    print(0)
    exit()
# 5で割れる数は変わらないが、
# 階乗の計算にするため、2で悪
n //= 2
ans=n

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

print(kosu(n,5))

Submission status: Accepted

Solution code:
inp=int(input())

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

    print(ans)

Submission status: Accepted

Solution code:


def resolve():
    N=int(input())
    c=0
    if N %2 ==1:
        print(0)
        return
    N//=10
    c=N
    while N!=0:
        N//=5
        c+=N
    print(c)





if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
N = int(input())
count = 0
if N % 2 == 0:
	for i in range(0,100):
		if N >= (10*(5**i)):
			#print((N//(10*(5**i)))*(i+1))
			count += ((N//10)//(5**i))
		else:
			break;
	print(count)
else:
	print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

from sys import stdin

n = int(stdin.readline().rstrip())

j = 1
k = 0
while n // (10 * j) > 0:
 k = k + n // (10 * j)
 j = j * 5

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

Submission status: Accepted

Solution code:
import sys
n=int(input())
if n%2==1:
    print(0)
    sys.exit()
n//=2
res=0
while n/5!=0:
    res+=n//5
    n//=5
print(res)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
div = 5

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

    print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

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

    if N % 2 == 1:
        return 0

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

print(e_double_factorial())

Submission status: Accepted

Solution code:
n = int(input())

tot = 0
cur = 5
if n%2 == 1:
  print(0)
else:
  while n//(cur*2) >= 1:
    tot = tot + n//(cur*2)
    cur = cur*5
  print(tot)

Submission status: Accepted

Solution code:
import sys
MAX_INT = int(10e12)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
ans = 0

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

Submission status: Accepted

Solution code:
n=int(input())
res=0
if (n%2)==0:
    x=5
    while True:
        if (n//x)==0:
            break
        d=n//x
        if (d%2)==1:
            d=(d-1)//2
        else:
            d//=2
        res+=d
        x*=5
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#n 10**18

n=int(input())
if n%2==1:
  print(0)
  exit()
  
n=n//2
#(2n)!! > 2**k * n!
#5の数を数える
ans=0
for i in range(1,31):
  ans+=n//(5**i)
  #print(i,n//5**i)
  
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
l = len(str(N))

ans = 0
digit = 10

if N < 2:
  print(0)

#Nが奇数なら10が作れないため0個
elif N % 2 == 1:
  print(0)

#末尾0の個数 = 因数における10(=2 * 5) の個数だが
#2の個数＞5の個数のため、与えられたNが5で割り切れた回数を求めれば良い
else:
  while N >= digit:
    ans += N // digit
    digit = digit * 5
  
  print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
num = 10
cnt = 0
if N%2!=0:
  print(0)
  exit()
for i in range(1, N+1):
  cnt += N//num
  num = num*5
  if num > N:
    break
print(cnt)

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

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

ans = 0
p = 10
while True:
    ans += N // p
    p *= 5
    if p > N:
        break

print(ans)

Submission status: Accepted

Solution code:
def f2(n):
  if n % 2 != 0: return 0
  ans = 0
  d = 10
  while n >= d:
    ans += n // d
    d *= 5
  
  return ans

n = int(input())
print (f2(n))

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
 
ans = 0
 
if N%2 == 0:
    for i in range(100000000000):
        fact = 10 *(5 ** i)
        if fact<=N:
            ans+=int(N//fact)
        else:
            break
 
 
print(int(ans))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)


def solve(N):
    if N % 2 == 1:
        return 0
    s = 5
    ans = 0
    while N > s:
        ans += N // s // 2
        s = s * 5
    return ans


def main():
    N = int(input())
    ans = solve(N)
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

N = int(input().split()[0])

if N % 2 == 0:
    total_n = 0
    count = 1
    while True:
        p = (N // 2) // (5 ** count)
        total_n += p
        count += 1
        if p <= 0:
            break
    ans = total_n
else:
    ans = 0

print(ans)

Submission status: Accepted

Solution code:
'''
def a(b):
    if b <= 1:
        return 1
    return b*a(b-2)
'''
n = int(input())

count = 1

ans = 0
if n%2 == 1:
    print(0)
else:
    for i in range(50):
        kakeru = 10*5**i
        if kakeru <= n:
            ans += n//kakeru
            count *= 10
        else:
            break

    print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if n % 2 == 1:
    print(0)
    exit(0)
lst = []
i = 1
while n >= 5 ** i:
    lst.append(n//(2 * (5**i)))
    i += 1
    
ans = 0
for i in range(len(lst)):
    ans += lst[i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
if n%2==1:
    print(0)
    exit()
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)
    exit()

ans = 0
mod = 10

while (mod <= N):
    ans += N // mod
    mod *= 5

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
if n%2==1:
    print(0)
else:#2,4,6,8,10...
    n=(n//2)
    k=0
    while n>4:
        n=(n//5)
        k+=n
    print(k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
if n%2==1:
    print(0)
else:#2,4,6,8,10...
    n=(n//2)
    k=0
    while n>0:
        k+=(n//5)
        n=(n//5)
    print(k)

Submission status: Accepted

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

if N & 1:
    print(0)
    exit()
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
    v = 10
    while N >= v:
        ans += N // v
        v *= 5

    print(ans)

Submission status: Accepted

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

if n % 2 == 0:
    j = 10
    while j <= n:
        a += n // j
        j *= 5

# print("10: {} 50: {}".format(a, b))

print(a)

Submission status: Accepted

Solution code:
n = input()

alpha = int(n[0])
beta = len(n) - 1

n = int(n)

if n % 2 != 0:
    print('0')
else:
    five = 0
    cnt = 1
    x = 5
    while x <= n:
        five += n // 10  // x
        cnt += 1
        x *= 5

    ans = n // 10 + five
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())

# N が奇数の場合は 0 になる
if N % 2 == 1:
    print(0)
else :
    n = N // 10
    cnt = n
    while n >= 5:
        n = n // 5
        cnt += n
    print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())



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

Submission status: Accepted

Solution code:
# import numpy as np
import sys
import math
input = sys.stdin.readline

N = int(input())

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

res = 0

temp = 10

while N >= temp:
    res += N // temp
    temp *= 5

print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()

if n < 10:
    print(0)
    quit()

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import sys
from pprint import pprint
import math

n = int(sys.stdin.readline().strip())
n_max = 10 ** 18

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

Submission status: Accepted

Solution code:
s=int(input())
list=[]
for i in range(25):
  list.append(pow(5,i+1)*2)
a=0
for j in range(len(list)):
  a+=s//list[j]
if s%2==1:
  print(0)
else:
  print(a)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

if N%2 == 0:
    for i in range(100000000000):
        fact = 10 *(5 ** i)
        if fact<=N:
            ans+= (N//fact)
        else:
            break


print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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


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


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
# coding: utf-8
N = int(input())
if N % 2 != 0:
    print(0)
    exit()
else:
    ans = 0
    i = 1
    ans += N // 10
    N //= 10
    while N > 0 :
        ans += N // 5
        N //= 5
    print(ans)