AtCoder Beginner Contest 148 - Double Factorial

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-----
12

-----Sample Output-----
1

f(12) = 12 × 10 × 8 × 6 × 4 × 2 = 46080, which has one trailing zero.

Source: atcoder | Difficulty: MEDIUM


Solutions:
n = int(input())
if n % 2 == 1:
	print(0)
	exit()
A = 0
add = 10
while n >= add:
	A += n // add
	add *= 5
print(A)


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


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


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


n = int(input())
if n <= 4:
	print(0)
	return
if n % 2 == 1:
	print(0)
	return
cnt = 10
ans = 0
for i in range(100):
	ans += n // cnt
	cnt *= 5
print(ans)


N = int(input())
c = 0
if N % 2 != 0:
	pass
else:
	for i in range(26):
		d = 5 ** (i + 1) * 2
		c += N // d
print(c)


import sys
input = sys.stdin.readline

def main():
	N = int(input())
	if N % 2 == 1:
		print(0)
		return
	count = []
	i = 0
	while True:
		q = N // (10 * 5 ** i)
		if q == 0:
			break
		else:
			count.append((q, i + 1))
			i += 1
	ans = 0
	prev_c = 0
	for (c, n_zero) in count[::-1]:
		ans += n_zero * (c - prev_c)
		prev_c = c
	print(ans)

def __starting_point():
	main()
__starting_point()


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


n = int(input())
if n % 2 == 1:
	print(0)
	exit()
print(sum([n // (2 * 5 ** i) for i in range(1, 50)]))


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


n = int(input())
if n % 2:
	print(0)
	exit()
n = n // 2
c = 0
while n:
	c += n // 5
	n = n // 5
print(c)


n = int(input())
sum = 0
if n % 2 == 0:
	a = n
	while a > 0:
		a = a // 5
		sum += a // 2
print(sum)


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


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


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


n = int(input())
if n % 2:
	print(0)
else:
	c = 0
	n //= 2
	while n:
		n //= 5
		c += n
	print(c)


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


N = int(input())
if N % 2 == 1:
	print(0)
else:
	ans = 0
	for i in range(50):
		ans += N // (10 * 5 ** i)
	print(ans)


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


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


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


(n_2, r) = divmod(int(input()), 2)
ans = 0
i = 1
if not r:
	while n_2 >= 5 ** i:
		ans += n_2 // 5 ** i
		i += 1
print(ans)


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


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


N = int(input())
ans = 0
if N % 2 == 0:
	seed = N // 2
	while seed > 0:
		seed = seed // 5
		ans += seed
print(int(ans))


n = int(input())
if n & 1:
	print(0)
else:
	ans = 0
	x = 10
	while n >= x:
		ans += n // x
		x *= 5
	print(ans)


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


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


N = int(input())
if N % 2 or N < 10:
	print(0)
else:
	(cnt, n) = (0, 1)
	while n <= N:
		cnt += N // (10 * n)
		n *= 5
	print(cnt)


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


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


import sys
n = int(input())
if n % 2 == 1:
	print(0)
	sys.exit()
ans = 0
for i in range(25):
	ans += n // (10 * 5 ** i)
print(ans)


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


n = int(input())
if n % 2 != 0:
	print(0)
else:
	k = 10
	q = 0
	while k <= n:
		q += n // k
		k *= 5
	print(q)


n = int(input())

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

def g2(n, p):
	if n % 2 == 1:
		return g1(n, p) - g2(n - 1, p)
	res = g1(n // 2, p)
	if p == 2:
		res += n // 2
	return res
ans = min(g2(n, 5), g2(n, 2))
print(ans)


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


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


import sys
N = int(input())
if N % 2 != 0:
	print(0)
	return
else:
	sum = 0
	num = N
	num_tmp = num // 5
	while num_tmp > 0:
		num_tmp = num // 5
		sum += num // 10
		num = num_tmp
print(sum)


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


N = int(input())
if N % 2 or N < 10:
	print(0)
	return
ans = 0
i = 1
while 2 * 5 ** i <= N:
	ans += N // (2 * 5 ** i)
	i += 1
print(ans)


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


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


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


import sys
n = int(input())
d = 10
a = 0
if n % 2 != 0:
	print(0)
	sys.exit()
while n >= d:
	a += n // d
	d *= 5
print(a)


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


N = int(input())

def solve_function(N):
	if N % 2 == 1:
		return 0
	n = 10
	ans = 0
	while True:
		if n > N:
			break
		ans += N // n
		n *= 5
	return ans
if solve_function(N):
	print(solve_function(N))
else:
	print(0)


N = int(input())
if N % 2 == 1:
	print(0)
	return
n = 10
ans = 0
while True:
	if n > N:
		break
	ans += N // n
	n *= 5
print(ans)


import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007

def main():
	N = int(readline())
	if N % 2:
		print(0)
		return
	ans = 0
	N //= 2
	while N:
		N //= 5
		ans += N
	print(ans)
	return

def __starting_point():
	main()
__starting_point()


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


import sys
n = int(input())
if n % 2 == 1:
	print(0)
	return
ans = 0
cnt = 1
while 5 ** cnt * 2 <= n:
	ans += n // (5 ** cnt * 2)
	cnt += 1
print(ans)


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


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


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


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


import sys
pin = sys.stdin.readline

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


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


n = int(input())
if n % 2 == 1:
	print(0)
	exit(0)
n = n // 2
i = 0
f = 5
while n // f > 0:
	i += n // f
	f = f * 5
i += n // f
print(i)


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

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

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	if n % 2 == 1 or n < 10:
		return 0
	st = 10
	ans = []
	while st <= n:
		ans.append(n // st)
		st *= 5
	return sum(ans)
print(main())


def main():
	N = int(input())
	if N % 2 != 0:
		print(0)
		return
	ans = 0
	i = 1
	while 2 * 5 ** i <= N:
		ans += N // (2 * 5 ** i)
		i += 1
	print(ans)
main()


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


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


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


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


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


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


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

def __starting_point():
	resolve()
__starting_point()


N = int(input())
a = 10
b = 0
if N & 1 == 0:
	while a <= N:
		b += N // a
		a *= 5
print(b)


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


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


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


print(sum([0 if n % 2 == 1 else n // 2 // d for (n, d) in zip([int(input())] * 29, [5 ** i for i in range(1, 30)])]))


n = int(input())
if n % 2 != 0:
	print(0)
else:
	ans = 0
	dum = 5
	while n > dum:
		ans += n // dum // 2
		dum = dum * 5
	print(ans)


n = int(input())
if n % 2 == 1:
	print('0')
	return
count = 0
for i in range(1, 30):
	count += n // (2 * 5 ** i)
print(count)


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)


n = int(input())
if n % 2:
	print(0)
else:
	n //= 2
	a = 0
	while 0 < n:
		n //= 5
		a += n
	print(a)


N = int(input())
if N % 2 == 0:
	answer = 0
	N //= 2
	for i in range(100):
		answer += N // 5
		N //= 5
	print(answer)
else:
	print('0')


N = int(input())
c = 0
if N % 2 == 0:
	m = 10
	while N // m > 0:
		c += N // m
		m *= 5
print(c)


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)


N = int(input())
if N % 2 == 1:
	print(0)
	return
n = 0
i = 0
for i in range(1, 26):
	n += N // (5 ** i * 2)
print(n)


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


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


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


n = int(input())
if n % 2 == 0:
	n5 = 1
	y = 10
	c = []
	while y <= n:
		c.append(n // y)
		if len(c) > 1:
			c[-2] -= c[-1]
		y *= 5
	cnt = 0
	for i in range(len(c)):
		cnt += c[i] * (i + 1)
	print(cnt)
else:
	print(0)


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


N = int(input())
if N % 2 == 0:
	p = 10
	cnt = 0
	while N // p != 0:
		cnt = cnt + N // p
		p = p * 5
	print(cnt)
else:
	print(0)


n = int(input())
if n % 2 == 0:
	print(sum([n // (5 ** i * 2) for i in range(1, 100)]))
else:
	print(0)


n = int(input())
if n % 2 == 1:
	print(0)
	return
ans = 0
ex = 1
while True:
	expo = 2 * 5 ** ex
	if n // expo == 0:
		break
	ans += n // expo
	ex += 1
print(ans)


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


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


N = int(input())
n = N // 10
cnt = 0
if N % 2 == 0:
	while n != 0:
		cnt += n
		n //= 5
print(cnt)


n = int(input())
if n % 2 == 1:
	print(0)
	return
fcnt = 0
tmp = 5
while n >= tmp:
	fcnt += n // 2 // tmp
	tmp *= 5
print(fcnt)


n = int(input())
g = 0
if n % 2 != 1:
	t = 10
	while t <= n:
		g += n // t
		t *= 5
print(g)


n = int(input())
a = m = n // 10
while m:
	m //= 5
	a += m
print(-~n % 2 * a)


import math
N = int(input())
if N % 2 == 1:
	print(0)
	return
ans = 0
i = 1
while 1:
	a = 2 * 5 ** i
	if N // a == 0:
		break
	ans += N // a
	i += 1
print(ans)


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


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


(c, n) = (0, int(input()))
if n % 2 < 1:
	n //= 2
	while n:
		n //= 5
		c += n
print(c)


n = int(input())
if n % 2 == 1:
	print(0)
	return
mp = tmp = 0
while True:
	if 5 ** tmp > n:
		break
	mp = tmp
	tmp += 1
ans = 0
for i in range(1, mp + 1):
	ans += n // (2 * 5 ** i)
print(ans)


N = int(input())
if N % 2 == 0:
	Ans = 0
	p = 1
	check = 0
	while check != 0 or p == 1:
		check = N // (2 * 5 ** p)
		Ans += check
		p += 1
	print(Ans)
else:
	print(0)


n = int(input())
if n % 2 == 1:
	print(0)
	return
ans = 0
cnt = 0
ones = 0
keta = []
cnt = 5 * 2
while n >= cnt:
	ans += n // cnt
	cnt *= 5
print(ans)


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


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


n = int(input())
ans = 0
d = 5
for i in range(36):
	ans += n // d // 2
	d *= 5
print(0 if n % 2 else ans)


import sys
N = int(input())
if N % 2 == 0:
	k = N // 2
	tmp = 5
	ans = 0
	while k >= tmp:
		ans += k // tmp
		tmp *= 5
else:
	ans = 0
print(ans)


import sys
N = int(input())
if N % 2 == 1:
	print(0)
	return
tot = 0
i = 10
while N >= i:
	tot += N // i
	i *= 5
print(tot)


n = int(input())
m = n // 10
f = []
while m:
	f.append(m % 5)
	m //= 5
print(0 if n % 2 else sum((a * (5 ** (i + 1) // 4) for (i, a) in enumerate(f))))


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


n = int(input())
fives = [0]
if n % 2 == 1:
	print(0)
else:
	i = 0
	while 1:
		temp5 = n // 5 ** (i + 1) // 2
		if temp5 != 0:
			fives.append(temp5)
			i += 1
		else:
			break
	print(sum(fives))


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


N = int(input())
if N % 2 == 1:
	print(0)
else:
	L = N // 2
	count2 = 0
	while L > 0:
		count2 += L // 5
		L //= 5
	print(count2)


n = int(input())
if n % 2 == 1:
	print(0)
	return
n //= 2
t = 1
count = -1
while n >= t:
	t *= 5
	count += 1
ans = 0
for i in range(1, count + 1):
	ans += n // 5 ** i
print(ans)


import sys
N = int(input())
if N % 2 != 0:
	print(0)
	return
N //= 10
cnt = 0
while N > 0:
	cnt += N
	N //= 5
print(cnt)


n = int(input())
if n % 2 != 0:
	print(0)
	return
n //= 10

def Base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy > 0:
		out = str(X_dumy % n) + out
		X_dumy = X_dumy // n
	return out
n = Base_10_to_n(n, 5)
n = reversed(list(n))
tmp = 1
ans = 0
for i in n:
	ans += int(i) * tmp
	tmp = tmp * 5 + 1
print(ans)


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


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


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


from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float('inf')
(YES, Yes, yes, NO, No, no) = ('YES', 'Yes', 'yes', 'NO', 'No', 'no')
(dy4, dx4) = ([0, 1, 0, -1], [1, 0, -1, 0])
(dy8, dx8) = ([0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1])

def inside(y, x, H, W):
	return 0 <= y < H and 0 <= x < W

def ceil(a, b):
	return (a + b - 1) // b

def sum_of_arithmetic_progression(s, d, n):
	return n * (2 * s + (n - 1) * d) // 2

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	g = gcd(a, b)
	return a / g * b

def solve(n):
	if n % 2 != 0:
		return 0
	total = 0
	now = 5
	while now <= n:
		total += n // (now * 2)
		now *= 5
	return total

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

def __starting_point():
	main()
__starting_point()


n = int(input())
if n % 2:
	print(0)
else:
	s = 0
	x = 10
	while n // x:
		s += n // x
		x *= 5
	print(s)


n = int(input())
if n % 2 != 0:
	print(0)
	return
ketasu = len(str(n))
ans = 0
for i in range(1, 100):
	ans += n // (2 * 5 ** i)
print(ans)


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


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


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


n = int(input())
if n % 2 == 1:
	print(0)
	return
cnt = 0
i = 1
if n % 2 == 0:
	while n // (2 * 5 ** i) > 0:
		cnt += n // (2 * 5 ** i)
		i += 1
print(cnt)


n = int(input())
if n % 2:
	print(0)
else:
	n = n // 2
	ans = 0
	for i in range(10000):
		n = n // 5
		ans += n
	print(ans)


def func(n):
	if n % 2 == 1:
		return 0
	res = 0
	n //= 2
	while n:
		res += n // 5
		n //= 5
	return res
n = int(input())
print(func(n))


n = int(input())
if n < 2:
	print(0)
else:
	ans = 0
	if n % 2 == 1:
		print(0)
	else:
		ans += n // 10
		for i in range(100):
			ans += n // (10 * 5 ** (i + 1))
		print(ans)


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


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


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)


n = input()
m = len(n)
n = int(n)
if n % 2 == 1:
	print(0)
elif m == 1:
	print(0)
else:
	ans = 0
	i = 1
	while True:
		ans_plus = n // (2 * 5 ** i)
		if ans_plus == 0:
			break
		ans += ans_plus
		i += 1
	print(ans)


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


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

def __starting_point():
	N = int(input())
	solve(N)
__starting_point()


n = int(input())
s = 0
if n % 2 == 0:
	m = 10
	while n >= m:
		s += n // m
		m *= 5
print(s)


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


N = int(input())
if N % 2 != 0 or N < 10:
	print(0)
else:
	n = N // 2
	count5 = 0
	while n >= 5:
		n = n // 5
		count5 += n
	print(count5)


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


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


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


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


import math
N = int(input())
ans = 0
if N == 0 or N % 2 == 1:
	ans = 0
else:
	digN = round(math.log(N, 5))
	i = 1
	while i <= digN:
		ans += N // (5 ** i * 2)
		i += 1
print(ans)


(a, n) = (0, int(input()))
if n % 2 < 1:
	n //= 2
	while n:
		n //= 5
		a += n
print(a)


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


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


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


N = int(input())
if N & 1:
	print(0)
	exit()
N //= 2
cnt = 0
while N:
	cnt += N // 5
	N //= 5
print(cnt)


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


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


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


import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter, defaultdict, deque
from itertools import permutations, combinations
from heapq import heappop, heappush
sys.setrecursionlimit(10 ** 8)
mod = 10 ** 9 + 7

def inp():
	return int(input())

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

def inpl():
	return list(map(int, input().split()))

def inpls():
	return list(input().split())

def inplm(n):
	return list((int(input()) for _ in range(n)))

def inplL(n):
	return [list(input()) for _ in range(n)]

def inplT(n):
	return [tuple(input()) for _ in range(n)]

def inpll(n):
	return [list(map(int, input().split())) for _ in range(n)]

def inplls(n):
	return sorted([list(map(int, input().split())) for _ in range(n)])
n = inp()
ans = 0
if n % 2 == 1:
	ans = 0
else:
	div = 10
	while div <= n:
		ans += n // div
		div *= 5
print(ans)


n = int(input())
if n % 2:
	print(0)
else:
	x = n // 2
	k = 0
	while x > 0:
		k += x // 5
		x //= 5
	print(k)


import math
from decimal import *

def cnt_prime(p, n):
	div = Decimal(str(n))
	s = 0
	while True:
		div /= p
		if div < 1:
			break
		if p == 2:
			s += int(div.quantize(Decimal('0.0'), rounding=ROUND_FLOOR))
		else:
			s += int(div.quantize(Decimal('0.0'), rounding=ROUND_FLOOR)) // 2
	return s
N = int(input())
if N % 2 == 1:
	print(0)
else:
	print(min(cnt_prime(2, N), cnt_prime(5, N)))


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


def solve(N: int):
	if N % 2 == 0:
		N = N // 2
		answer = 0
		div = 5
		while N >= div:
			answer += N // div
			div *= 5
		return answer
	else:
		return 0
	return answer

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

def __starting_point():
	main()
__starting_point()


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


N = int(input())
if N % 2:
	print(0)
else:
	X = 0
	Y = N // 5
	while Y:
		X += Y // 2
		Y //= 5
	print(X)


N = int(input())
if N % 2:
	print(0)
	quit()
total = 0
N //= 2
while N:
	N //= 5
	total += N
print(total)


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


import bisect, collections, copy, itertools, math, string
import sys

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

def LI():
	return list(map(int, sys.stdin.readline().rstrip().split()))

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

def LS():
	return list(sys.stdin.readline().rstrip().split())

def main():
	n = I()
	if n % 2 == 0:
		ans = 0
		for i in range(1, 27):
			ans += n // (2 * pow(5, i))
		print(ans)
	else:
		print(0)
main()


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


n = int(input())
ans = 0
tmp = 0
p = 1
if n % 2 == 0:
	k = n // 2
	while True:
		tmp = k // pow(5, p)
		ans += tmp
		p += 1
		if tmp == 0:
			break
print(ans)


n = int(input())
if n % 2 == 1:
	print(0)
else:
	print(sum((n // (2 * 5 ** d) for d in range(1, 25 + 1))))


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


N = int(input())
ans = 0
m = 10
if N & 1:
	print(0)
	exit()
while N >= m:
	ans += N // m
	m *= 5
print(ans)


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


import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque, Counter
from decimal import Decimal
import functools

def v():
	return input()

def k():
	return int(input())

def S():
	return input().split()

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

def X():
	return list(input())

def L():
	return list(input().split())

def l():
	return list(map(int, input().split()))

def lcm(a, b):
	return a * b // math.gcd(a, b)
sys.setrecursionlimit(10 ** 6)
mod = 10 ** 9 + 7
cnt = 0
ans = 0
inf = float('inf')
al = 'abcdefghijklmnopqrstuvwxyz'
AL = al.upper()
n = k()
if n % 2 == 1:
	print(0)
else:
	for i in range(1, n):
		if n >= 2 * 5 ** i:
			cnt += n // (2 * 5 ** i)
		else:
			break
	print(cnt)


n = int(input())
ans = 0
frc = 10
if n % 2 == 0:
	while n // frc:
		ans += n // frc
		frc *= 5
print(ans)


n = int(input())
if n % 2 != 0:
	print(0)
	exit()
else:
	ans = 0
	n //= 2
	p = 5
	while p <= n:
		ans += n // p
		p *= 5
print(ans)


import math
N = int(input())
a = 0
b = 10
if N % 2 != 0:
	print(0)
else:
	while N >= b:
		a += N // b
		b = b * 5
	print(a)


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


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


import sys
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.141592653589793

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

def read_int():
	return int(sys.stdin.readline().strip())

def read_ints():
	return map(int, sys.stdin.readline().strip().split())

def read_ints2(x):
	return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())

def read_str_list():
	return list(sys.stdin.readline().strip().split())

def read_int_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def GCD(a: int, b: int) -> int:
	return b if a % b == 0 else GCD(b, a % b)

def LCM(a: int, b: int) -> int:
	return a * b // GCD(a, b)

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

def Main():
	n = read_int()
	if n % 2:
		print(0)
		return
	ans = 0
	n //= 2
	while n >= 5:
		n //= 5
		ans += n
	print(ans)

def __starting_point():
	Main()
__starting_point()


n = int(input())
if n % 2:
	print(0)
else:
	p = n // 2
	l = 0
	while p > 0:
		l += p // 5
		p //= 5
	print(l)


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


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


N = int(input())
n = 0
if not N % 2:
	s = 5
	N = N // 2
	while N >= s:
		n += N // s
		s *= 5
print(n)


n = int(input())
if n % 2 != 0:
	print(0)
else:
	A = 0
	m = 10
	while n // m > 0:
		A += n // m
		m *= 5
	print(A)


n = int(input())
if n % 2 == 1:
	print('0')
else:
	five = 0
	two = 0
	for i in range(1, n):
		f = n // (2 * 5 ** i)
		t = n // 2 ** i
		if f == t == 0:
			break
		five += f
		two += t
	print(min(five, two))