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:
    c = 0
    k = 10
    while k <= N:
        c += (N // k) 
        k *= 5
    print(c)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

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

print(int(ans))

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
def fx(X, n):
    if (X//n):
      #print(X//5)
      return fx(X//n, n)+X//n
    return 0

N=int(input())
if N%2==1:
  print(0)
else:
  print(fx(N//2,5))

Submission status: Accepted

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


def solve():
  n = int(input())
  s = str(n)
  if n%2 == 1:
    print(0)
  else:
    ans = 0
    n //= 2
    for i in range(1,35):
      tmp = 5**i
      ans += n//tmp
    
       
    print(ans)

solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
if N%2==1:
    print(0)
else:
    numbers=[]
    number=10
    while number<=pow(10,18):
        numbers.append(number)
        number*=5
    answer=0
    for a in numbers:
        answer+=N//a
    print(answer)

Submission status: Accepted

Solution code:
N = int(input())

if N & 1 == 0:
	sum = 0
	N //= 10
	while N != 0:
		sum += N
		N //= 5
	print(sum)
else:
	print(0)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

ans = 0
N //= 2
while N :
    ans += N//5
    N //= 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

    print(total)

Submission status: Accepted

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

if N<10 or N%2==1:
  print(0)
else:
  N//=10
  answer=0
  while(N>0):
    answer+=math.floor(N)
    N//=5

  print(answer)

Submission status: Accepted

Solution code:
n = int(input())

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

tmp = 1
idx = 0
while True:
	tmp *= 5
	if tmp >= n:
		break
	idx += 1

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

print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())

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

tmp = 1
idx = 0
while True:
	tmp *= 5
	if tmp >= n:
		break
	idx += 1

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

N = int(input())
if N%2 == 1 or N<10:
  print(0)
  exit()
five = N//10
for i in range(int(math.log(N//10,5))):
  five += N//(10*5**(i+1))
print(five)

Submission status: Accepted

Solution code:
N = int(input())


def func(x):
    return len(str(x))


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())


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

print(ans)

Submission status: Accepted

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

if n % 2 == 0:
    n = n // 2
    fives = 5
    while 1:

        if fives > n: 
            break
        ans += n // fives
        fives *= 5

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

print(cnt_5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import heapq
import collections
import itertools
sys.setrecursionlimit(100001)

# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

# n, m = map(int, input().split())

n = int(input())

# data =[]
# for i in range(n):
#     tmp = [int(n) for n in input().split()]
#     data.append(tmp)

if n == 0:
    print(0)
    exit(0)

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

ans = 0
keta = 10
for i in range(30):
    ans += n//keta
    keta *= 5

    if keta > n:
        break

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

if n <= 4:
    print(0)
    exit()

if n % 2 == 0:
    m = n // 2
    res = 0
    for i in range(1, 100):
        res += m // (5 ** i)
    print(res)
else:
    print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
if N % 2 == 1:
    print(0)
else:
    N_copy = N
    N_copy //= 2
    count_5 = 0
    count_2 = 0
    while N_copy > 0:
        N_copy //= 5
        count_5 += N_copy
    while N > 0:
        N //= 2
        count_2 += N
    print(min(count_2, count_5))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline

    n = int(input())

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



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())

# 奇数の場合
if N % 2 == 1:
    print(0)
    exit()

while N % 10 != 0:
    N -= 1

ans = 0

x = 1
# 5**xで割り切れる個数
while N // ((5 ** x) * 2) > 0:
    ans += N // ((5 ** x) * 2)
    x += 1

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
count = 0
a = n//2
b = 5

if n % 2 != 0:
    print(count)
else:
    while True:
        count += a//b
        if a//b == 0:
            break
        b *= 5

    print(count)

Submission status: Accepted

Solution code:
import math
n = int(input())
if n % 2 != 0 or n == 0:
    print(0)
    exit()
l = math.ceil(math.log(n, 5))
#print(l)
ans = 0
for i in range(1, l + 1):
    #print(pow(5, i), n // pow(5, i))
    ans += n // pow(5, i) // 2
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

if n % 2 == 1:
    print(0)
else:
    t= 0
    for i in range(1, 1000):
        if 5**i <= n:
            t += (n//(5**i))//2
        else:
            break
    print(t)

Submission status: Accepted

Solution code:
N=int(input())

if N%2!=0:
    print(0)
else:
    ans=0
    for i in range(36):
        ans+=N//(10*(5**i))
    print(ans)

Submission status: Accepted

Solution code:
n=int(input());print(sum(n//(10*(5**i))for i in range(99))*(n%2==0))

Submission status: Accepted

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

for i in range(50):
    if n >= 10*(5**(i)):
        ans += n//(10*(5**(i)))
print(ans)

Submission status: Accepted

Solution code:
n=int(input());print(sum(n//(10*(5**i)) for i in range(99))*(n%2==0))

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

def main():
    N = int(input())
    
    if N&1:
        print(0)
    else:
        num = 10
        ans = 0
        tmp = N // num
        while tmp > 0:
            ans += tmp
            num *= 5
            tmp = N // num
        print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():

    n = int(input())

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

    while n>4:
        ans += n // 5
        n = n // 5

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

    print(ans)



if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

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:
    print(0)
    exit()
ans=0
for i in range(1,50):
    ans+=n//(2*5**i)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
if N%2 == 0:
    N //= 2
    for i in range(40):
        ans += N//5
        N = N//5

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

counter = 0

N_temp = N
while N_temp//5 != 0:
	N_temp = N_temp//5
	counter += 1

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

Submission status: Accepted

Solution code:
#import math
#import bisect
#import numpy as np
#import itertools
#import copy
import sys
from collections import deque

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    n = int(input())
    ans = 0

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

def solve(n):
    res = 0
    if n % 2 == 1:
        return 0
    
    t = 10
    while t <= n:
        res += n // t
        t *= 5
    
    return res

print(solve(n))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
if n%2==1:
    print(0)
else:
    m=n//2 #2は余計なので割る
    ans=0
    a=5 #5の倍数判定
    while a<=m:
        ans+=m//a
        a*=5
    print(ans)

Submission status: Accepted

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

def main():
    n=int(input())
    cnt=5
    ans=0
    if n%2==0:
        n=n//2
        while cnt<=n:
            ans+=n//cnt
            cnt*=5
    print(ans)                
    
if __name__ == '__main__':
    main()

Submission status: Accepted

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


def main():
    n = int(input())
    ans = 0

    if n % 2 == 1:
        print(ans)
    else:
        division = 10

        while division <= n:
            ans += n // division

            division *= 5

        print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())

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


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

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
#f=nf(n-2)

count=0
if N%2==1:
    print(0)
else:
    count+=N//10
    #print(count)
    N//=10
    while N>=5:
        count+=N//5
        #print(count)
        N//=5
    print(count)
#
"""
def f(n):
    if n>=2:
        answer=n
        n-=2
    while n>=2:
        answer*=n
        n-=2
    return answer
print(f(N))
"""

Submission status: Accepted

Solution code:
from math import factorial

N = int(input())

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

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

#Nが奇数の時は末尾に０はない（因数に２をもたないから）
if N%2!=0:
    print(0)
    exit()
    

#Nまでの数を書き出して、いつ5の因数を持つか実験して法則性をつかめばいい
#この時i=5にしないこと！（Nから2つとびで減ってるため！）
ans=0
i=10
while(i<=N):
    ans+=N//i
    i*=5
print(ans)

Submission status: Accepted

Solution code:
def f(x):
	if(x==0):
		return 0
	else:
		return x//10+f(x//5)
x = int(input())
if x%2 == 1:
	print(0)
else:
	print(f(x))

Submission status: Accepted

Solution code:
n = int(input())

count = 0
i = 1
while True:
    temp = 2 * (5 ** i)
    count += n // temp
    if temp > n:
        break
    else:
        i += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

n//=2
ans=0
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:
   print(0)
   exit()

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from collections import Counter
import sys

sys.setrecursionlimit(10 ** 6)

mod = 1000000007
inf = int(1e18)

dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]


def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft


def main():
    n = int(input())
    if n % 2 == 1:
        print(0)
        return
    ans = n // 10
    for i in range(1, 32):
        ans += n // (5**i*10)
    print(ans)

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

N = int(input())
if N % 2 == 1:
  print(0)
else:
  zero_count = 0
  if N == 0:
    print(0)
  else:  
    for i in range(1,1+int(math.log(N//2,5)//1)):#ここのN//2がN/2にしてただけで計算が狂った。floatの扱いの問題か
      zero_count += (N//2)//(5**i)
    print(int(zero_count))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
from collections import deque, Counter
def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math

def main():
    n = getN()
    parity = n % 2
    if parity == 1:
        print(0)
        return
    ans = 0

    tmp = 5
    while(tmp <= n):
        rep = n // tmp
        ans += (rep + parity) // 2
        tmp *= 5

    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

cnt=0
num=10
while True:
    cnt+=n//num
    num *= 5
    if num > n:
        break

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

import sys
ans = 0

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

print(ans)

Submission status: Accepted

Solution code:





N = int(input())

"""
Nが偶数
f(2) = 2 * f(0) = 2 * 1
f(4) = 4 * f(2) = 4 * 2 * 1
f(6) = 6 * f(4) = 6 * 4 * 2 * 1
となる。
どれも2の倍数なので、2*5**xで割り切れる個数が答え


Nが奇数
f(3) = 3 * f(1) = 3 * 1
f(5) = 5 * 3 * 1
f(7) = 7 * 5 * 3 * 1
なので、偶数が出てくることがないので0
"""

if N in [0,1]:
    print(0)

elif N % 2 == 1:
    print(0)
else:
    ans = 0
    num = 1
    while 5**num <= N:
        cnt = N // (2*5**num)
        ans += cnt
        num += 1

    print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
import copy

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

n = ni()
if n % 2 != 0:
    print(0)
else:
    n2 = copy.copy(n)
    n5 = copy.copy(n)
    c2, c5 = 0, 0
    while n2 > 1:
        n2 //= 2
        c2 += n2
    while n5 > 1:
        n5 //= 5
        c5 += n5//2
    print(min(c2, c5))

Submission status: Accepted

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

Submission status: Accepted

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

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

r = 0
L = int(mt.log(N,5))
for i in range(1,L+1):
    p = N//(5**i)//2
    r += p
    #print(N,5**i,p)
print(r)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def trailingZeros(n):
	cnt = 0
	i = 10
	while(n//i >= 1):
		cnt += n//i
		i *= 5
	return cnt

x = int(input())
if x%2 != 0:
	print(0)
else:
	print(trailingZeros(x))

Submission status: Accepted

Solution code:
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

n = int(input())

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

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


print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

# 入力が奇数のときははじく
if N % 2 == 1:
    print(0)
    exit(0)

exp = 1
zero_count = 0
#counters = []
while 2*(5 ** exp) <= N:
    count = N // (2* (5 ** exp))
    zero_count += count
    exp += 1

print(zero_count)

Submission status: Accepted

Solution code:
i = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    if n%2==1:
        print(0)
        return 
    
    ans = 0
    bunbo = 10
    while bunbo <= n:
        ans += n // bunbo
        bunbo *= 5
    print(ans)
 
 
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
if N&1:
    print(0)
    exit()
count = 0
x = 1
while N >= 5**x:
    count += N // (2 * 5**x)
    x += 1

print(count)
# 23

Submission status: Accepted

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

def main():
    N = int(input())
    if N % 2 == 1:
        print(0)
    else:
        N //= 2
        count = 0
        while N > 1:
            N //= 5
            count += N
        print(count)
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())


ans = 0
if n % 2 == 0:
    w = 2
    while True:
        w *= 5
        tmp = n // w
        if tmp == 0:
            break
        ans += tmp

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import groupby 

N = int(input())

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

print(solve(N))

Submission status: Accepted

Solution code:
from itertools import groupby 

N = int(input())

def solve(N):
    if (N % 2 == 1):
        return 0
    
    d = N // 10
    ans = d
    while d:
        d //= 5
        ans += d
    return ans

print(solve(N))

Submission status: Accepted

Solution code:
N = int(input())

if N % 2 == 1:
    print(0)
else:
    beki5 = 1
    sum0 = 0
    while 1:
        beki5 = beki5 * 5
        if beki5 > N:
            break
        else:
            sum0 += N//(beki5*2)
    print(sum0)
a = 0

Submission status: Accepted

Solution code:
n = int(input())

if n%2 != 0:
    ans = 0
else:
    ans = 0
    x = 10
    while n >= x:
        ans += n//x
        x *= 5

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
def m5(N):
    count = 0
    while True :
        k = N // 5
        if k == 0 :
            break
        else :
            N = k
            count += k // 2
    return count
if N % 2 == 1 :
    print(0)
else :
    s = str(N)
    o = int(s[-1])
    N -= o
    print(m5(N))

Submission status: Accepted

Solution code:
n = int(input())
if n%2 != 0:
  print(0)
else:
  k = 2
  cnt2 = 0
  l = 5
  cnt5 = 0
  while k <= n:
    cnt2 += n//k
    k *= 2
  while n//l != 0:
    cnt5 += (n//l)//2
    l *= 5
  print(min(cnt2,cnt5))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

if N%2==1:
    print(0)
else:
    k2, k5 = 0, 0
    s = 1
    while 1:
        v = N//(2**s)
        if v==0:
            break
        else:
            k2 += v
        s+=1

    s = 1
    while 1:
        v = N//(5**s)
        if v==0:
            break
        else:
            k5 += (v//2)
        s+=1
    
    print(min(k2, k5))

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

    nsa = ns - 1
    ans = 0
    for i in range(nsa,0,-1):
        o = nbase//(5**i)
        ans += o//2

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

N = int(input())

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

Submission status: Accepted

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