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: Wrong Answer

Solution code:
n=int(input())

if n//2==n/2:
    a=1
    while not n<5**a:
        a=a+1

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


else:
    print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
import math
if N<=10:
  if N==7 or N==9 or N==10:
    print(1)
    exit()
  else:
    print(0)
    exit()

if N%2==0:
  A=[10]
  i=20
  while i<=N:
    A.append(i)
    i+=10
else:
  A=[5]
  i=15
  while i<=N:
    A.append(i)
    i+=10
a=0
for i in A:
  a+=int(math.log(i,5))
print(a)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = int(list(str(n))[-1])

def count_five(n):
    cnt  = 0
    while n%5 == 0:
        n = n / 5
        cnt += 1
    return cnt

if n%2 == 1:
    print(0)
else:
    mx = count_five(n - s)
    cnt = 0
    for i in range(1, mx+9):
        cnt += (n - s) // (2*(5**i))
    print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
 
if n % 2 != 0:
    print(0)
    quit()
 
num = 0
for i in range(1, 10000):
    div = int(n / 5 ** i)
    if div == 0:
        break
    div = int(div / 2)
    num += div
 
print(num)

Submission status: Wrong Answer

Solution code:
import sys

test = int(input())

a = 1

for i in range(test, 1, -2):
    a *= i
a = str(a)
res = 0
for i in range(len(a) - 1, 0, -1):
    if a[i] == "0":
        res += 1
    else:
        print(res)
        sys.exit()

Submission status: Wrong Answer

Solution code:
n = int(input())

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

num = 0
for i in range(1, 10000):
    div = int(n / 5 ** i)
    if div == 0:
        break
    print(5**i, div)
    div = int(div / 2)
    num += div

print(num)

Submission status: Wrong Answer

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

answer = 0
for i in range(18, 0, -1):
    n = 10 ** i
    answer += (N // n)
print(answer)

Submission status: Wrong Answer

Solution code:
"""
Atcoder_Beginner_Contest_148
E - Double Factorial
https://atcoder.jp/contests/abc148/tasks/abc148_e
"""
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000000)

N = int(input())

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

zero_count = 0
divide_number = 10
while divide_number <= N:
    zero_count += int(N / divide_number)

    # print("zero_count:{},divide_number:{}".format(zero_count, divide_number))
    divide_number *= 5

print(int(zero_count))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

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

print(a)

Submission status: Wrong Answer

Solution code:
N=int(input())
M=len(str(N))
#print(M)
A=[0]*(M-1)
Ans=0

if N%2==1:
	Ans=0
else:
	for i in range(M-1):
		print(i)
		#A[i]=N//(10**(i+1))
		Ans+=(i+1)*(N//(10**(i+1)))
	#print(A)

print(Ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
l = len(str(n))
ans = 0

for i in range(1, l):
  if i == 1:
    ans += n // 10
  ans += n // (5*10**i)

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
count = -1
for i in range(N,0,-10):
    count += 1

print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())

if N%2:
    print(0)
else:
    t = N//10
    f = N//50
    if f >0:
        dub = t//f
    else:
        dub = 0
    
    tw = N//200
    
    print(t+f+tw-dub)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(ans)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
ans = 0
if(n%2 != 1):
  for i in range(30):
    pau = 2 * pow(5,i+1)
    ans = ans + math.floor(n / pau)
print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin, setrecursionlimit
setrecursionlimit(10 ** 6)


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


def solve(N):
    result = f(N)
    count = 0
    for x in str(result)[::-1]:
        if x == '0':
            count += 1
        else:
            break
    return count


def solve2(N):
    if N % 2 == 1:
        return 0
    if N == 0:
        return 0
    a = N // 50
    b = N // 10
    c = N // 250
    d = N // 1250
    e = N // 6250
    return b + a + c + d + e


def main():
    N = int(stdin.readline().rstrip())
    result = solve2(N)
    print(result)

    # result = solve(N)
    # print(result)

    # ans = []
    # for x in range(1, 300):
    #     result = solve(x)
    #     ans.append((x, result))

    # for x in ans:
    #     a, b = x
    #     print(a, b)

    # current = 0
    # count = 0
    # for x in ans:
    #     a, b = x
    #     if a % 2 == 1:
    #         continue
    #     if b == current:
    #         count += 1
    #     elif b == current + 1:
    #         print(current, count)
    #         current = b
    #         count = 0
    #     else:
    #         print(current, count)
    #         print(current + 1, 0)
    #         current = b
    #         count = 0


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
if N%2==0:
    num_list = []
    for i in range(1, 1000):
        if (N < 5 ** i):
            break
        num_list.append(i)
    ans_list = []
    for num in num_list:
        ans_list.append(int(N / (5 ** num) / 2))
    ans = 0
    for i in range(len(ans_list)):
        ans = ans + ans_list[i]
    print(ans)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
N = int(input())
if N%2==1:
    print(0)
    exit(0)
ans = 0
tmp = N//(5*10)//2
for i in range(1, len(str(N))):
    # if i != len(str(N))-1:
    #     ans+=(10**(i))
    ans += N//5//2
    N //= 10
print(ans+tmp)

Submission status: Wrong Answer

Solution code:
N=int(input())

if N%2==0:
    print("test")
else:
    print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
five=5
s = 0
for i in range(n):
  s+=int(n/five/2)
  if int(n/five/2) < 2: break
  five *= 5
print(int(s))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

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

print(a)

Submission status: Wrong Answer

Solution code:
"""
Atcoder_Beginner_Contest_148
E - Double Factorial
https://atcoder.jp/contests/abc148/tasks/abc148_e
"""
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000000)

N = int(input())

calc_end = N

zero_count = 0
divide_number = 10
while divide_number <= calc_end:
    zero_count += int(N / divide_number)
    # print("zero_count:{},divide_number:{}".format(zero_count, divide_number))
    divide_number *= 5

print(int(zero_count))

Submission status: Wrong Answer

Solution code:
N=int(input())
a=5
b=2
cnt_a=0
cnt_b=0
while a<N:
    cnt_a+=(N//a)//2
    a*=5
while b<N:
    cnt_b+=(N//b)//2
    b*=2
print(min(cnt_a,cnt_b))

Submission status: Wrong Answer

Solution code:
n = int(input())

count = 0
j = 0
i = 1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n  = int(input())
d  = 10
k  = 0
xs = []
ys = []

while d <= n:
	xs.append(n // d)
	d *= 10
	k += 1
	
d = 50

while d <= n:
	ys.append(n // d)
	d *= 10
	
xs = reversed(xs)
ys = reversed(ys)

c = 0
p = 0

for x in xs:
	c += k * (x - p)
	k -= 1
	p  = x

p = 0

for y in ys:
	c += y - p
	p  = y

print(c)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N=input()

ans=0
N/=10
ans+=N

while 0<N:
    N/=5
    ans+=N
print ans

Submission status: Wrong Answer

Solution code:
import decimal
N = input()
N = decimal.Decimal(N)

five = 0
i = 0
if N % 2 == 1:
    print(0)
else:
    while True:
        i += 1
        if 2 * (5 ** i) > N:
            break
        else:
            temp = N / (decimal.Decimal(2) * decimal.Decimal(5)**decimal.Decimal(i))
            temp = decimal.Decimal(temp).quantize(decimal.Decimal('0.1'))
            five += temp//1
print(five)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=n
tmp=n
ans=0
if n>2:
  for i in range(n//2-1):
    tmp=tmp*(a-2)
    a=a-2
l=len(str(tmp))
for i in range(l):
  if tmp%10==0:
    ans=ans+1
    tmp=tmp//10
  else:
    break
print(ans)

Submission status: Wrong Answer

Solution code:
import decimal
N = input()
N = decimal.Decimal(N)

five = 0
i = 0
if N % 2 == 1:
    print(0)
else:
    while True:
        i += 1
        if 2 * (5 ** i) > N:
            break
        else:
            temp = N / (decimal.Decimal(2) * decimal.Decimal(5)**decimal.Decimal(i))
            temp = decimal.Decimal(temp).quantize(decimal.Decimal('0.01'))
            five += temp//1
print(five)

Submission status: Wrong Answer

Solution code:
N=int(input())
import math
if N<=10:
  if N==7 or N==9 or N==10:
    print(1)
    exit()
  else:
    print(0)
    exit()

if N%2==0:
  A=[i for i in range(2,N+1) if i%10==0]
else:
  A=[i for i in range(1,N+1) if i%5==0 and i%2!=0]
a=0
for i in A:
  a+=int(math.log(i,5))
print(a)

Submission status: Wrong Answer

Solution code:
N = int(input())

#まともにやったら再帰エラーで死ぬ
def factorial(n):
    if (n < 2):
        return 1
    else:
        return n * factorial(n - 2)

if (N % 2 == 0):
    num = int(N / 2)
    fiveCounter = 1

    #１０で何回わりきれるか

    #5の倍数の数
    fiveFactor = 5
    counter = 0
    while (num >= fiveFactor):
        counter += int(num / fiveFactor)
        fiveFactor *= 5

    print(counter)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
ans = 0
if(n%2 != 1):
  for i in range(25):
    pau = 2 * 5 ** (i+1)
    ans = ans + math.floor(n / pau)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
n=int(input())
five=5
s = 0
if n%2==1:
  print(0)
  sys.exit(0)
for i in range(n):
  s+=int(n/five/2)
  if int(n/five/2) < 2: break
  five *= 5
print(int(s))

Submission status: Wrong Answer

Solution code:
n = int(input())
cnt = [0] * 18
ans = 0
if n % 2 == 1:
    print(0)
else:
    for i in range(18):
        cnt[i] = n // (10 ** (i + 1))
    print(sum(cnt))

Submission status: Wrong Answer

Solution code:
import decimal
N = input()
N = decimal.Decimal(N)

five = 0
i = 0
if N % 2 == 1:
    print(0)
else:
    while True:
        i += 1
        if 2 * (5 ** i) > N:
            break
        else:
            temp = N / (decimal.Decimal(2) * decimal.Decimal(5)**decimal.Decimal(i))
            temp = decimal.Decimal(temp).quantize(decimal.Decimal('0.0000000001'))
            five += temp//1
print(five)

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = 0

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

Submission status: Wrong Answer

Solution code:
n=int(input())

if n//2==n/2:
    a=1
    while not n<5**a:
        a=a+1

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


else:
    print(0)

Submission status: Wrong Answer

Solution code:
def fac0(a):
    r = 0
    while a > 0:
        r += int(a/5)
        a = int(a/5)
    return(r)

N = int(input())

#for i in range(999999999999999900,1000000000000000001):
#    N = i
#    print("i=",i)
    
if N % 2 == 0:
    N = int(N/2)
    print(fac0(N))
else:
    print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

#まともにやったら再帰エラーで死ぬ
def factorial(n):
    if (n < 2):
        return 1
    else:
        return n * factorial(n - 2)

if (N % 2 == 0):
    num = int(N / 2)
    fiveCounter = 1

    #１０で何回わりきれるか

    #5の倍数の数
    fiveFactor = 5
    counter = 0
    while (num >= (fiveFactor * 2)):
        counter += int(num / fiveFactor)
        fiveFactor *= 5

    print(counter)
else:
    print(0)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
Nby = N // 10
result =  N // 10
for i in range(1, 30):
    result +=  Nby // (5 ** i)

print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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 *= 10
  k = 50
  while N >= k:
    total += N // k - N // (2 * k) 
    k *= 10
  print(total)

Submission status: Wrong Answer

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

if n==0:
    print(1)

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

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = N // 10

tmp = N // 10
while 5 <= tmp:
    ans += tmp // 5
    tmp = tmp // 5

print(ans)

Submission status: Wrong Answer

Solution code:
import decimal
N = input()
N = decimal.Decimal(N)

five = 0
i = 0
if N % 2 == 1:
    print(0)
else:
    while True:
        i += 1
        if 2 * (5 ** i) > N:
            break
        else:
            temp = N / (decimal.Decimal(2) * decimal.Decimal(5)**decimal.Decimal(i))
            temp = decimal.Decimal(temp).quantize(decimal.Decimal('0.000000001'))
            five += temp//1
print(five)

Submission status: Wrong Answer

Solution code:
N = int(input())

if N%2 == 0:
    count = 0
    check = int(N/2)
    n = 1
    while True:
        waru = 5**n
        if check >= waru:
            count += check//waru
            n += 1
        else:
            print(count)
            break
        
else:
    print(0)

Submission status: Wrong Answer

Solution code:
N = int(input())
tens = 0
ans = 0
warimono = 5

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

Submission status: Wrong Answer

Solution code:
n = int(input())

print(n // 10)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = 0

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

Submission status: Wrong Answer

Solution code:
N = int(input())

###########################################
###########################################


def factorization(n):# 素因数分解
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

###########################################
###########################################

    
count = N // 2        # 切り捨て除算


# 素因数分解して2と5の少ない方選べばよい。
# 素因数分解して2と5の少ない方選べばよい。
# 素因数分解して2と5の少ない方選べばよい。
# 素因数分解して2と5の少ない方選べばよい。
# 素因数分解して2と5の少ない方選べばよい。
# 素因数分解して2と5の少ない方選べばよい。
# 素因数分解して2と5の少ない方選べばよい。
# 素因数分解して2と5の少ない方選べばよい。
# 素因数分解して2と5の少ない方選べばよい。
# 素因数分解して2と5の少ない方選べばよい。
# 素因数分解して2と5の少ない方選べばよい。
# 素因数分解して2と5の少ない方選べばよい。

AN5 = 0
AN2 = 0

for i in range(count):
    cal = N-i*2
    AN1 = factorization(cal)
    try:
        if AN1[0][0] == 2 :
            AN2 = AN2 + AN1[0][1]
    except:
        kari = 1
    try:
        if AN1[0][0] == 5 :
            AN5 = AN5 + AN1[0][1]
    except:
        kari = 1
    try:        
        if AN1[1][0] == 2 :
            AN2 = AN2 + AN1[1][1]
    except:
        kari = 1
    try:        
        if AN1[1][0] == 5 :
            AN5 = AN5 + AN1[1][1]
    except:
        kari = 1
    try:        
        if AN1[2][0] == 2 :
            AN2 = AN2 + AN1[2][1]
    except:
        kari = 1
    try:        
        if AN1[2][0] == 5 :
            AN5 = AN5 + AN1[2][1]
    except: 
        kari = 1


if AN2 < AN5 :
    print(AN5)
else:
    print(AN2)

Submission status: Wrong Answer

Solution code:
"""
Atcoder_Beginner_Contest_148
E

"""
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000000)

N = int(input())

calc_end = N

zero_count = 0
divide_number = 10
while divide_number < calc_end:
    zero_count += int(N / divide_number)
    # print("zero_count:{},divide_number:{}".format(zero_count, divide_number))
    divide_number *= 5

print(int(zero_count))

Submission status: Wrong Answer

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

if __name__=="__main__":
  main()

Submission status: Wrong Answer

Solution code:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time
from fractions import gcd
#import random


def I(): return int(input())


def MI(): return map(int, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


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


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YN = ['No', 'Yes']
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']


show_flg = True
show_flg = False


def factorization(n):
    """
    素因数分解
    :param int n:
    :rtype: list of int
    """
    if n <= 1:
        return []

    ret = []
    while n > 2 and n % 2 == 0:
        ret.append(2)
        n //= 2
    i = 3
    while i <= math.sqrt(n):
        if n % i == 0:
            ret.append(i)
            n //= i
        else:
            i += 2
    ret.append(n)
    return ret


def main():
    N = I()
    n = 5
    ans = 0

    if N % 2 == 1:
        while N % 5 != 0 or N % 2 == 0:
            N -= 1

    while n <= N:
        ans += N // n // 2
        n *= 5

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N=int(input())
a=5
b=2
cnt_a=0
cnt_b=0
while a<N:
    cnt_a+=(N//a)//2
    a*=5
while b<N:
    cnt_b+=(N//b)//2
    b*=5
print(min(cnt_a,cnt_b))

Submission status: Wrong Answer

Solution code:
N = int(input())

double = 2
five = 5
cnt2 = 0
cnt5 = 0
while True:
    cnt2 += (N // 2) // double
    cnt5 += (N // 2) // five

    double *= 2
    five *= 5
    if double > N and five > N:
        break

print(int(cnt5))

Submission status: Wrong Answer

Solution code:
n = int(input())

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

ans = 0
for i in range(1, 20):
    ans += (n // (10 ** i)) * i

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

a = N // 50
b = N // 10

print(a + b)

Submission status: Wrong Answer

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 valid(tgt):
    # a = nums[tgt]
    a = tgt
    valid = 0
    while (True):
        # print(valid, a)
        if a % 10 == 0:
            valid += 1
            a = a // 10
        else:
            break
    return valid

def main():
    n = input().strip()
    #
    # n = 100
    # nums = [0 for i in range(int(100001))]

    # tmp = 1
    # for i in range(1,50001):
    #     # print(i)
    #     tmp = i * 2 * tmp
    #
    # print("val")

    # print(valid(tmp))
    # for i, num in enumerate(nums[:1001]):
    #     print(str(i) + ":" +str(num))
    # while(True):
    """
    tval = 0
    
    for i in range(5001):

        tgt = i * 2
        valv = valid(nums, tgt)
        if tval != valv:
            print("{} : {}".format(tgt, valv))
            tval = valv
    return
    """

    keta = [0 for i in range(20)]
    keta[1] = 1
    keta[2] = 12
    for i in range(3, 20):
        keta[i] = keta[i-1] * 10 + 4
        if i > 3:
            keta[i] += 5

    # print(keta)
    ans = 0
    if int(n[-1]) % 2 == 1:
        print(0)
        return

    else:
        prev = ""
        pprev = ""
        for i, digit in enumerate(n[::-1]):
            ans += int(digit) * keta[i]
            if i == 1:
                bonus = int(digit) // 5
            elif i == 2:
                bonus = int(digit + prev) // 25
            else:
                bonus = int(digit + prev + pprev) // 125
                if int(digit + prev + pprev) >= 625:
                    bonus += 1
            ans += bonus
            prev = digit
            pprev = prev

        print(ans)



if __name__ == "__main__":
    main()

"""
1000
124
2000
249
3000
374
4000
499
5000
624
6000
748
8000
999
9000
1124
10000
1249

"""

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
ans = 0
if(n%2 != 1):
  for i in range(50):
    pau = 2 * 5 ** (i+1)
    if(n >= pau):
      ans = ans + math.floor(n / pau)
print(ans)

Submission status: Wrong Answer

Solution code:
def calc(a,n):
    num = 50
    while n > num:
      a += n//num
      num *= 5
    return a

n = int(input())

if n % 2 == 1:
  print(0)
  exit()
else:
  a = n // 10  
  print(calc(a,n))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())
def trailing_zero_num(n):
    num = 0

    while True:
        n = int(n / 10)
        if n == 0:
            break
        num = num + n

    return num
print(trailing_zero_num(n))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

#まともにやったら再帰エラーで死ぬ
def factorial(n):
    if (n < 2):
        return 1
    else:
        return n * factorial(n - 2)

if (N % 2 == 0):
    num = int(N / 2)
    fiveCounter = 1

    #１０で何回わりきれるか

    #5の倍数の数
    fiveFactor = 5
    counter = 0
    while (num > fiveFactor):
        counter += int(num / fiveFactor)
        fiveFactor *= 5

    print(counter)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
N = int(input())

if N%2 != 0:
  answer = 0
else:
  answer = 0
  m = 1
  while (N/2)//(5**m) != 0:
    answer += int((N/2)//(5**m))
    m += 1 
print(answer)

Submission status: Wrong Answer

Solution code:
N = int(input())
ls = [1 for i in range(19)]
for i in range(1, 19):
  ls[i] = i + ls[i-1]*10

ans = 0
i = 0
while N:
  N= N//10
  ans += (N%10)*ls[i]
  i+=1
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
x = n
for y in range(n-2, 1, -2):
    x*=y
j=str(x)
p=len(j) - len(j.rstrip('0'))
print(p)

Submission status: Wrong Answer

Solution code:
n = input()
ans = 0
if int(n) % 2 != 0:
    print(0)
else:
    ans = 0
    cnt = 0
    for i in range(1, len(n) + 1):
        ans += cnt * int(n[-(i)])
        cnt = cnt * 10 + 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 0
N = N // 10
while N != 0:
  ans += N
  N = N // 5
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())


def findTrailingZeros(n):
    # Initialize result
    count = 0
    c2=0
    # Keep dividing n by
    # powers of 5 and
    # update Count
    i = 5
    while (n / i >= 1):
        kk=int(n/i)
        count += (kk//2)

        i *= 5
    i = 2
    while (n / i >= 1):
        kk = int(n / i)
        c2 += (kk // 2)

        i *= 2

    return min(c2,count)
get5s=findTrailingZeros(n)

print(get5s)

Submission status: Wrong Answer

Solution code:
from math import log, floor
N = int(input())

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

Submission status: Wrong Answer

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

if n % 2 == 1:
  c = 0
else:
  a = len(str(n))
  for i in range(1,a+1):
    c += (n // (10 ** i))
print(c)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

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

print(num)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

if n == 0 or n == 1:
  print(0)
elif n%2 == 1:
  print(0)
else:
  print(int((n/2)//5))

Submission status: Wrong Answer

Solution code:
n = int(input())
m=n
ans=0
for i in range(18):
    ans+=m//10 
    m=m//10
m=n//10   
for i in range(44):
    ans+=m//5
    m=m//5
m=n//10
for i in range(18):
    ans-=m//10 
    m=m//10

    
print(int(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 0
if N % 2 == 0:
    while 10 * ans <= N:
        ans += 1
else:
    ans = 0

print(ans - 1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

#まともにやったら再帰エラーで死ぬ
def factorial(n):
    if (n < 2):
        return 1
    else:
        return n * factorial(n - 2)

num = int(N / 2) + (N % 2)
fiveCounter = 1

#１０で何回わりきれるか

#5の倍数の数
fiveFactor = 5
counter = 0
while (num > fiveFactor):
    counter += int(num / fiveFactor)
    fiveFactor *= 5

print(counter)

Submission status: Wrong Answer

Solution code:
import decimal
N = input()
N = decimal.Decimal(N)

five = 0
i = 0
if N % 2 == 1:
    print(0)
else:
    while True:
        i += 1
        if 2 * (5 ** i) > N:
            break
        else:
            temp = N / (decimal.Decimal(2) * decimal.Decimal(5)**decimal.Decimal(i))
            temp = decimal.Decimal(temp).quantize(decimal.Decimal('0.0001'))
            five += temp//1
print(five)

Submission status: Wrong Answer

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


def solve():
    N = int(input())
    if N%2==1:
        print(0)
    else:
        num2=0
        for i in range(1,61,1):
            chk = (2**i)
            if N<chk:
                break
            else:
                num2 += int(N/chk)
        num5=0
        for i in range(1,30,1):
            chk = (5**i)*2
            if N<chk:
                break
            else:
                num5 += int(N/chk)
        print(min(num2,num5))


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))  # applies to only numbers
rs = lambda: stdin.readline().rstrip()  # ignores trailing space

N = ri()

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

answer = N // 10

while N >= 50:
    answer += (N // 50)
    N //= 50
print(answer)

Submission status: Wrong Answer

Solution code:
def fac0(a):
    r = 0
    while a > 0:
        r += a // 5
        a = a // 5
    return(r)

N = int(input())

#for i in range(25):
#    N = i
#    print("i=",i)
    
if N % 2 == 0:
    N = int(N/2)
    print(fac0(N))
else:
    print(0)