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==1:
    print(0)
else:
    n = N//2
    a = n
    cnt = 0
    while a>1:
        cnt += a//2
        a = a//2
    a = cnt
    b = n
    cnt = 0
    while b>1:
        cnt += b//5
        b = b//5
    b = cnt
    c = n
    cnt = 0
    while c>1:
        cnt += c//10
        c = c//10
    c = cnt
    n2 = a-c+n
    n5 = b-c
    print(c+min(n2,n5))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
def g(n):
  ret = 0
  while(n >= 5):
    n = n // 5
    ret += n
  return ret

if N % 2 == 0:
  print(g(N // 2))
else:
  print(0)

Submission status: Accepted

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


def solve(N: int):

    if N % 2 == 1:
        print(0)
    else:
        ans = N // 10
        for i in range(1, 100000):
            tmp = N // (10 * (5**i))
            if tmp == 0:
                break
            ans += tmp
        print(ans)
    return


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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in range(80):
    if 2*5**(i+1)<=n:
        count+=n//(2*5**(i+1))
    else:
        break
print(count)

Submission status: Accepted

Solution code:
N = int(input())

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

else:
    res = 0
    res += N // 10
    a = 50
    while a <= N:
        res += N // a
        a *= 5
    print(res)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
i = 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import log10, floor

N = int(input())

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

# def f(n):
#     if n < 2:
#         return 1
#     else:
#         return n * f(n - 2)
# def ff(n):
#     if n <= 1:
#         return 1
#     else:
#         return n * ff(n - 1)
# for i in range(1, 50):
#     if i % 2 == 0:
#         print(i, f(i), 2 ** (i // 2) * ff(i // 2))

# f(i) = 2 ** (i // 2) * f(i // 2) なので， (i // 2)!を数える
NN = N // 2
count = 0
i = 1
# print(NN)
while True:
    ans = NN // 5 ** i
    if ans == 0:
        break
    # print(NN, i, ans)
    NN = NN // 5
    # count += (5 ** i) * ans
    count += ans
    # i += 1
print(count)

Submission status: Accepted

Solution code:
N = int(input())

if N % 2 == 1:  # 奇数なら0
    print(0)
else:
    ans = 0
    pow50 = 50
    while pow50 <= N:
        ans += N//pow50
        pow50 *= 5
    gozyu_baisuu = N//50
    zyuu_baisuu = N//10
    # gohyaku_baisuu = N //200
    print(ans + zyuu_baisuu)
# 1000000000000000000
# 124999999999999995

# 120000000000000000

Submission status: Accepted

Solution code:
n = int(input())

def f(num):
    num = num - int(str(num)[-1])
    count = 0
    i = 1
    while True:
        if ((5 ** i) * (2)) > num:
            break
        count += (num // ((5 ** i) * (2)))
        i += 1
    return count


# 偶数 => 出てくる5の個数
# 奇数 => 0
if n % 2 == 1:
    print(0)
    exit()
else:
    print(f(n))

Submission status: Accepted

Solution code:
N=int(input())
c=0
if N%2==1:
    print(0)
else:
    a=10
    for i in range(N):
        b=N//a
        if b>0:
            c=c+b
            a=a*5
        else:
            break
    print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

if N % 2 != 0:
    print(0)
else:
    a = N // 10
    b = a
    t = 0
    while b:
        tmp = b // 5
        t += tmp
        b = tmp
    print(a + t)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
if N % 2 == 1:
    print(0)
    sys.exit()
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:
    n=N
    A=0
    while n>=10:
       A+=n//10
       n//=10
    C=N//10
    B=N//50
    for i in range(1,100):
        B+=N//(50*(5**i))
    print(B+C)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
Ans = 0
waru = 10
plus = 0
if N % 2 == 1:
  print(Ans)
else:
  for i in range(100):
    plus = N // waru
    
    if plus == 0:
      break
      
    Ans = Ans + plus
    waru = waru * 5

  print(Ans)

Submission status: Accepted

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

if N%2==0:
    while 5**i<=N:
        Ndiv=N//(5**i)
        pmax=Ndiv*(5**i)
        result+=Ndiv//2
        i+=1

print(result)

Submission status: Accepted

Solution code:
n = int(input())

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

    print(ans)

Submission status: Accepted

Solution code:
n = int(input())
five = 0
two = 0

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

x = 2
while x <= n:
  two += n // x
  x *= 2

x = 5
while x*2 <= n:
  five += n // (x*2)
  x *= 5

print(min(two, five))

Submission status: Accepted

Solution code:
import math as m

N = int(input())
if N < 2 or N % 2 == 1:
    print(0)
    exit()
ans = 0
digit = 1
while N // (2 * pow(5, digit)):
    ans += N // (2 * pow(5, digit))
    digit += 1
print(ans)

Submission status: Accepted

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

import itertools


def count_trailing_zeros(n):
    if n % 2 == 1:
        return 0
    else:
        res = 0
        for i in itertools.count(1):
            p = 5 ** i
            if p > n:
                break
            res += n // (2 * p)
        return res


def main():
    n = int(input())
    res = count_trailing_zeros(n)
    print(res)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
''' بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ '''
#codeforces
gi = lambda : list(map(int,input().split()))
n, = gi()
ans = n // 10
cur = 50
while cur <= n:
	ans += n // cur
	cur *= 5
if n % 2:
	ans = 0
print(ans)

Submission status: Accepted

Solution code:
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    if n % 2 == 0:
        cnt = 0
        for i in range(1, 10 ** 10):
            pw = pow(5, i)
            if pw <= n:
                cnt += n // pw // 2
            else:
                print(cnt)
                exit()
    else:
        print(0)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
# %%
n = int(input())
def func(n):
    flag = True
    ans = 0
    i = 5
    while flag == True:
        temp = n // (i *2)
        ans += temp
        i = i*5
        if temp == 0:
            flag = False
    return ans

if (n % 2 )!= 0:
    print(0)
else:
    print(func(n))

Submission status: Accepted

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

num_5 = n//2//5

mul_5 = 5
while mul_5 <= n:
    cnt += n//2//mul_5
    mul_5 = mul_5*5
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
if N%2 == 0:
    num2 = 0
    d = 2
    while d <= N:
        num2 += N//d
        d *= 2

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

    ans = min(num2, num5)

print(ans)

Submission status: Accepted

Solution code:

def solve():
    n=int(input())
    if n<2:
        return 0
    out=0
    if n%2==0:
        while n>=10:
            n//=5
            out+=n//2
            
        return out
    else:
        return 0
    
    

print(solve())

Submission status: Accepted

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

def solve():
    N = int(input())
    if N % 2:
        res = 0
    else:
        q = 10
        p5 = 0
        while N // q:
            p5 += N // q
            q *= 5
        q = 2
        p2 = 0
        while N // q:
            p2 += N // q
            q *= 2
        res = min(p2, p5)
    return str(res)

if __name__ == '__main__':
    print(solve())

Submission status: Accepted

Solution code:
import sys
import math
import re
import io

def query(n, m):
    ans = 0
    while n > 0:
        ans += n // m
        n //= m
    return ans

def solve(n):
    if n < 2:
        return 0
    if n % 2 == 0:
        return query(n // 2, 5)
    return 0

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import sys

m=10**9 + 7 
N  = int(input())

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

x = 10 
fives = 0 
for i in range(1,27):
    fives = fives + ( N // x )
    x = x * 5

print(fives)

Submission status: Accepted

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

cnt = 0
M = 5 * 2
while M <= N:
    cnt += N // M
    M *= 5
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
INF = float("inf")


def f(n):
    ans = 1
    while True:
        if n < 2:
            break
        ans *= n
        n -= 2
    return ans


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

    # a = f(15)
    # print(a)
    # print("個数: ", str(a).count("0"))

    # a = f(150)
    # print(a)
    # print("個数: ", str(a).count("0"))

    # a = f(150)
    # print(a)
    # print("個数: ", str(a).count("0"))
    # ans = 0
    # n = N
    # while True:
    #     n //= 10
    #     ans += n
    #     if n < 10:
    #         break
    # print(ans)

    tot = 0
    base = 5
    while base <= N:
        tot += (N//base)//2
        base *= 5
    print(tot)

    # tot2 = 0
    # base = 10
    # while base <= N:
    #     tot2 += N//base
    #     base *= 10
    # print(tot-tot2)

    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())
if N % 2:
    print(0)
else:
    ans = 0
    for i in range(1, 40):
        ans += (N // (2 * (5**i)))
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def I(): return int(sys.stdin.readline())
def LI(): return [int(x) for x in sys.stdin.readline().split()]

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

    ans = 0
    ans += N//10
    q = 50
    while(N//q>0):
        ans += N//q
        q *= 5

    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
d = [0 for i in range(31)]
b = 0
if N % 2 == 0:
    for i in range(30):
        x = 30 - i
        y = 5**x
        a = (N//y)//2
        d[x] = a - b
        b = a
    ans = 0
    for i in range(1,31):
        ans += (d[i]*i)
else:
    ans = 0
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
if N%2==1:
  print(0)
  
elif N<=4:
  print(0)

else:
  a = 0
  while N>5**a:
    a+=1
    
  a-=1
  ans = 0
  for i in range(1,a+1):
    ans += N//(5**i)//2
    
  print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

def zeros(n):
    count = 0
    cur = n
    while(cur != 0 and cur % 10 == 0):
        cur = cur // 10
        count += 1
    return count

def est(n):
    ev = n // 10
    divider = 50
    while(n // divider != 0):
        ev += n // divider
        divider *= 5
    return ev

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

Submission status: Accepted

Solution code:
import sys

def solve():
    N = int(input())
    if N % 2 == 1: print(0)
    else: 
        ans = 0
        for i in range(18):
            ans += N // pow(10, i+1)
            fd = 5 * pow(10, i+1)
            while fd <= N:
                ans  += (N // fd + 1) // 2
                fd *= 5
        print(ans)
    
    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
N = int(input())
c = 0
n = 1
if N%2 == 1:
    print(0)
    exit(0)
while True:
    t = N//(5**n)//2
    if t == 0:
        break
    else:
        c += t
        n += 1
print(c)

Submission status: Accepted

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

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys


N = int(input())

def solve(N):
    if N % 2 == 1:
        return 0
    else:
        num_10 = N // 10

        k = 50
        num_5 = 0
        while k < 1e19:
            num_5 += N // k
            k *= 5

        return num_10 + num_5

# def brute(N):
#     s = 1
#     for n in range(N, 0, -2):
#         s *= n
    
#     st = reversed(str(s))
#     ans = 0
#     for ch in st:
#         if ch == '0':
#             ans += 1
#         else:
#             break
#     return ans

# for i in range(2, 252, 2):
#     print(i, brute(i))

# for i in range(1, 1000000):
#     ans = solve(i)
#     gt = brute(i)
#     if ans != gt:
#         print(i, ans, gt)
#         break

print(solve(N))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)
INF=10**18
def input():
    return sys.stdin.readline().rstrip()

def main():
    N=int(input())
    if N%2==0:
        c=N//10
        tmp=c
        ans=0
        z=0
        while tmp > 0:
            ans+=tmp
            tmp=tmp//5
    else:
        ans=0
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

if N%2==1:
    print(ans)
else:
    for i in range(1,40):
            a = 2*pow(5,i)
            ans+=(N//a)
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())
print(0 if N&1 else sum([N//10//5**i for i in range(99)]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding:utf-8

def cnt_five(n):
    i = 1
    cnt = 0
    while 5 ** i <= n:
        cnt += n // (5 ** i)
        i += 1
    return cnt

n = int(input())
if n % 2 != 0:
    print(0)
else:
    n //= 2
    print(cnt_five(n))

Submission status: Accepted

Solution code:
import math
def main():
    N = int(input())
    if N < 5:
        return 0
    if N % 2 == 1:
        return 0
    t = int(math.log(N, 5))
    a = 0
    for i in range(1, t+1):
        a += N // (2 * (5 ** i))
    return a
print(main())

Submission status: Accepted

Solution code:
import sys

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

def main():
    if n & 1:
        return 0
    ans = 0
    for i in range(30):
        ans += n // (10 * 5 ** i)

    return ans

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

Solution code:
##n-2
n = int(input())
ans = n//10
t = 50

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


print(ans)

Submission status: Accepted

Solution code:
import sys
import math
import bisect
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


# A
def A():
    a = I()
    b = I()
    print(6 - a - b)
    return


# B
def B():
    n = I()
    s, t = input().split(' ')
    ans = []
    for i in range(n):
        ans.append(s[i])
        ans.append(t[i])
    print(''.join(ans))
    return


# C
def C():
    def GCD(a, b):
        if (b == 0):
            return a
        else:
            return GCD(b, a % b)

    a, b = LI()
    print(a * b // GCD(a, b))
    return


# D
def D():
    n = I()
    a = LI()
    cnt = 0
    for i in range(n):
        if a[i] == cnt + 1:
            cnt += 1
    if cnt == 0:
        print(-1)
    else:
        print(n - cnt)
    return


# E
def E():
    n = I()
    if n % 2 != 0:
        print(0)
        return
    ans = 0
    i = 10
    while 1:
        if i > n:
            break
        ans += n // i
        i *= 5
    print(ans)
    return


# F
def F():
    return


# Unittest
def resolve():
    E()
    return


# Solve
if __name__ == "__main__":
    E()

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
import sys; readline = sys.stdin.readline
from collections import deque


N = int(readline())


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

def count(d, n):
    c = 0
    a = n
    while True:
        a = a // d
        if a == 0:
            break
        c += a
    return c

print(min(count(2,N), count(5, N // 2)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

  print(ans)

Submission status: Accepted

Solution code:
n = int(input())

d = 5

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():

    N = int(input())

    # ref = 1
    # for i in range(1, N//2+1):
    #     ref *= 2*i
    # print(ref)

    if N % 2 == 1:
        return 0
    else:
        tens = []
        p = 5
        while p <= N:
            tens.append(p)
            p *= 5

        ans = 0
        for p in tens:
            ans += N // (2*p)
        return ans


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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    if N % 2 == 1:
        return 0

    ret = 0
    for p in range(1, 30 + 1):
        ret += N // (2 * pow(5, p))
    return ret


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

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:
#from fractions import gcd
#x = list(map(int, input().split()))
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

N=int(input())
#奇数なら0は続かない
#偶数なら続く
#2よりも5の倍数の方が多いはずだから5の個数を数えれば良い
if N%2==1:
    print(0)
else:
    ans=N//10
    for i in range(1,30):
        ans+=((N//10)//(5**i))
    print(ans)

Submission status: Accepted

Solution code:
#import pysnooper
#import numpy
#import os,re,sys,operator
#from collections import Counter,deque
#from operator import itemgetter,mul
#from itertools import accumulate#,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from bisect import bisect_left,bisect_right
#from copy import deepcopy
#import heapq
#import math
#import string
#from time import time
#from functools import lru_cache,reduce
#from math import factorial
#import sys
from fractions import gcd
setrecursionlimit(10**6)
input=stdin.readline

n=int(input())
if n%2==1:
    print(0)
else:
    div2,div5=0,0
    a=n//2
    while a>1:
        div2+=a//2
        a//=2
    a=n//2
    while a>1:
        div5+=a//5
        a//=5
    print(min(div2,div5))

Submission status: Accepted

Solution code:
N = int(input())


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

Submission status: Accepted

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

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

Submission status: Accepted

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

B = N

#10の倍数が何個出てくるか-->純粋に0の数を数えている
count = N // 10
# print (count)

a = 50
while B >= a:
    count += B // a
    a *= 5

print (count)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
def legendre(n):

	ans1=0
	tp=2
	while(n//tp>0):
		ans1+=n//tp
		tp=tp*2

	ans2=0
	fp=5
	while(n//fp>0):
		ans2+=(n//fp)//2
		fp=fp*5

	if(N%2==0):
		# ans2//=2
		ans=min(ans1,ans2)
	else:
		ans=0

	return ans

N=int(input())

print(legendre(N))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
words = lambda t : list(map(t, input().split()))
n = int(input())

xs = []
for i in range(30):
    xs.append((n // (5**i)) // 2)

#print(xs)
if n % 2 == 0:
    print(sum(xs[1:]))
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,50):
    ans+=N//(2*5**i)
  print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
buf = [0 for i in range(30)]
how = 0
if n%2 == 1:
    how = 0
else:
    how = 0
    n = n//2
    base = 1
    for i in range(30):
        base = base*5
        ar =n//base
        buf[i] = ar
    for i in range(30):
        how += buf[i]
# print(buf)
print(how)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

k = 1

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

    print(ans)
else:
    print(0)

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
ans += N//10

i = 50
while i <= N:
    ans += N//i
    # if i*2 <= N:
    #     ans -= N//(i*2)
    i *= 5


print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import collections
#sys.setrecursionlimit(100000)

n=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

Sum = 0

if N % 2 != 0:
    print("0")
else:
    x = 10

    while N >= x:
        Sum += N // x
        x *= 5

    print(Sum)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

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

Submission status: Accepted

Solution code:
a = int(input())



def solve(a,st) :
    if st > a :
        return 0
    return a//st + solve(a,5 * st);


if a % 2 == 1 :
    print(0)
else :

    st = 10
    print(solve(a,st))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import exit

N = int(input())

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

result = 0
t = 10
while t <= N:
  result += N // t
  t *= 5
print(result)

Submission status: Accepted

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

Submission status: Accepted

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

if n % 2 != 0:
  print(0)
elif n == 0:
  print(0)
else:
  #print(zerocnt(n))
  r = 0
  for i in range(int(math.log(n, 5))):
    r = r + (n // (5**(i+1))) // 2
  print(r)

Submission status: Accepted

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

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

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 == 1:
  print(0)
else:
  div = 10
  ans = 0
  while n >= div:
    ans += n//div
    div *= 5
  print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())


def sub(n):
	max_v = int(math.log(n // 2, 5))
	ans = 0
	for i in range(max_v):
		ans += n // (2 * 5 ** (i + 1))
	return ans

def guess(n):
	if n % 2 == 1 or n < 10:
		return 0
	else:
		return sub(n)

print(guess(n))