Harryxun/stf_run huggingface dataset:
import sys, math, collections, heapq, itertools
  
def solve():
    file = sys.stdin.readline #single: int(file()), line: map(int, file().split())
    INF = 10 ** 25
    mod = 7 + 10 ** 9
    N = int(file())
    A = [int(a) for a in file().split()]
    A.sort()
    ans = 0
    out = []
    if N == 2:
        ans = A[1] - A[0]
        out = [A[1], A[0]]
    elif A[N-2] <= 0:
        ans = A[N-1] - A[N-2]
        out.append([A[N-1], A[N-2]])
        for i in range(N-2):
            out.append([ans, A[i]])
            ans -= A[i]
    elif A[1] >= 0:
        ans = A[0] - A[1]
        out.append([A[0], A[1]])
        for i in range(2, N-1):
            out.append([ans, A[i]])
        out.append([A[N-1], ans])
        ans = A[N-1] - ans
    else:
        for i in range(1, N-1):
            if A[i] >= 0:
                start = i-1
                break
        Ans = A[0] - A[N-1]
        out.append([A[0], A[N-1]])
        if start + 2 < N - 1:
            for i in range(start + 2 , N -1):
                out.append([ans, A[i]])
                ans -= A[i]
        if abs(A[start]) <= A[start + 1]:
            out.append([ans, A[start + 1]])
            ans -= A[start + 1]
            out.append([A[start], ans])
            ans = A[start] - ans
            for i in range(1, start):
                out.append([ans, A[i]])
                ans -= A[i]
        else:
            out.append([A[start + 1], ans])
            ans = A[start + 1] - ans
            for i in range(1, start + 1):
                out.append([ans, A[i]])
                ans -= A[i]

    print(ans)
    for k in out:
        print(" ".join(map(str, k)))

    return 0
  
if __name__ == "__main__":
    solve()

### FIXED CODE ###

import sys, math, collections, heapq, itertools
from bisect import bisect_left
  
def solve():
    file = sys.stdin.readline #single: int(file()), line: map(int, file().split())
    INF = 10 ** 25
    mod = 7 + 10 ** 9
    N = int(file())
    A = [int(a) for a in file().split()]
    A.sort()
    ans = 0
    out = []
    if N == 2:
        ans = A[1] - A[0]
        out = [[A[1], A[0]]]
    else:
        plus = bisect_left(A, 0)
        if plus == 0:
            ans = A[0]
            for i in range(1, N-1):
                out.append([ans, A[i]])
                ans -= A[i]
            out.append([A[N-1], ans])
            ans = A[N-1] - ans
        elif plus < N:
            ans = A[0]
            for i in range(plus, N - 1):
                out.append([ans, A[i]])
                ans -= A[i]
            out.append([A[N-1], ans])
            ans = A[N-1] - ans
            for i in range(1, plus):
                out.append([ans, A[i]])
                ans -= A[i]
        else:
            ans = A[N-1]
            for i in range(N-1):
                out.append([ans, A[i]])
                ans -= A[i]

    print(ans)
    for k in out:
        print(" ".join(map(str, k)))


    return 0
  
if __name__ == "__main__":
    solve()
N = int(input())
d = []
for i in range(N):
    d.add(int(input()))
print(set(len(d)))


### FIXED CODE ###

N = int(input())
d = []
for i in range(N):
    d.append(int(input()))
print(len(set(d)))
from collections import defaultdict
import heapq

vertices,edges = map(int,input().split(" "))
link = defaultdict(dict)
weight = defaultdict(dict)
way = [float("inf")] * vertices
for e in range(edges):
    source,target,w = map(int,input().split(" "))
    link[source] = link.get(source,set()) | {target}
    link[target] = link.get(target,set()) | {source}
    weight[source].update({target:w})
    weight[target].update({source:w})
queue = []
heapq.heapify(queue)
heapq.heappush(queue,[0,0])
went = set()
now_weight = 0
way[0] = 0

while len(went) < vertices:
    here_weight,here = heapq.heappop(queue)
    #print(now_weight,here)
    now_weight += here_weight
    can_go = link.get(here,set()) - went
    min_weight,next_t = float("inf"),-1
    for c in can_go:
        #heapq.heappush(queue,[now_weight + weight[here][c],c])
        if c not in went and way[c] > [weight[here][c]:
            heapq.heappush(queue,[weight[here][c],c])
            way[c] = [weight[here][c]
    #print(queue)
    went = went | {here}
print(now_weight)

### FIXED CODE ###

from collections import defaultdict
import heapq
vertices, edges = (int(n) for n in input().split(" "))
conn = defaultdict(set)
weight = defaultdict(dict)
for i in range(edges):
    v1, v2, w = (int(n) for n in input().split(" "))
    conn[v1] |= {v2}
    conn[v2] |= {v1}
    weight[v1][v2] = w
    weight[v2][v1] = w

queue = []
heapq.heapify(queue)
heapq.heappush(queue, [0,0])
went = set()
went_vertices = 0
answer_weight = 0
while went_vertices < vertices:
    here_weight, here_v = heapq.heappop(queue)
    if here_v in went:
        continue
    went |= {here_v}
    for c in conn[here_v]:
        if c not in went:
            heapq.heappush(queue,[weight[here_v][c], c])
    answer_weight += here_weight
    went_vertices += 1
print(answer_weight)
import os

def main():
        n = int(input())
        a_list = tuple(map(int, input().split()))
        list_set = set(a_list)
        zero_list = [0]*n
        print(a_list)
        for l in list_set:
                zero_list[i-1] = a_list[i]
        for i in zero_list:
                print(i)
        """
        list_set = set(a_list)
        for i in list_set:
                result[i-1] = a_list.count(i)
        for i in result:
                print(i)
        """

if __name__ == "__main__":
        main()


### FIXED CODE ###

import os

def main():
	n = int(input())
	a_list = list(map(int, input().split()))
	result = [0]*n
	for i in a_list:
		result[i-1] += 1
	for i in result:
		print(i)

if __name__ == "__main__":
	main()
a = input() // 数の個数
b = list(map(int, input().split())) // それぞれの値
count = 0
while(1):
  for i in range(a):
    if b[i] % 2 == 1:
      print("0")
      return 0;
  b /= 2
  count += 1
print(count)

### FIXED CODE ###

a = int(input())
b = list(map(int, input().split()))
count = 0
while(1):
  flag = 0
  for i in range(0, a, 1):
    if (b[i] % 2 == 1) :
      flag = 1
  if (flag == 1) :
    break
  for i in range(0, a, 1):
    b[i] /= 2
  count += 1
print(count)
n = int(input())
a = []
for i in range(n):
    _ = list(map(int, input().split()))
    a.append(_)
check = False
for i in range(101):
    for j in range(101):
        b = 0
        while b < n-1:
            if b == 0:
                h = abs(i - a[b][0]) + abs(j - a[b][1]) + a[b][2]
                b +=1
            else:
                de = abs(i - a[b][0]) + abs(j - a[b][1])
                if h -de == a[b][2]:
                    b+=1
                else:
                    break
        if b == n-1:
            ans = str(i) + ' ' + str(j) + ' ' +str(h)
            check = True
        if check:
            break
    if check:
        break
print(ans)

### FIXED CODE ###

n = int(input())
a = []
for i in range(n):
    _ = list(map(int, input().split()))
    a.append(_)
a = sorted(a, key=lambda x:x[2],reverse = True)

check = False
    
for i in range(101):
    for j in range(101):
        b = 0
        while b < n:
            if b == 0:
                h = abs(i - a[b][0]) + abs(j - a[b][1]) + a[b][2]
                b +=1
            else:
                de = max(h - abs(i - a[b][0]) - abs(j - a[b][1]),0)
                if de == a[b][2]:
                    b+=1
                else:
                    break
        if b == n:
            ans = str(i) + ' ' + str(j) + ' ' +str(h)
            check = True
        if check:
            break
    if check:
        break
print(ans)
n = int(input())
SMs = []
for i in range(2, n // 2 + 1):
    SMs.append(sum(list(map(int, str(i)))) + sum(list(map(int, str(n-i)))))
print(min(SMs))

### FIXED CODE ###

n = int(input())
SMs = []
for i in range(2, n // 2 + 2):
    SMs.append(sum(list(map(int, str(i)))) + sum(list(map(int, str(n-i)))))
print(min(SMs))
n=int(input())
l=list(map(int,input().split()))
cnt=0
t=0
for i in range(n-1):
  if(l[i]>=l[i+1]):
    cnt+=1
  else:
    t=max(cnt,t)
    cnt=0
t=max(cnt,%tb)
print(t)

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
cnt=0
t=0
for i in range(n-1):
  if(l[i]>=l[i+1]):
    cnt+=1
  else:
    t=max(cnt,t)
    cnt=0
t=max(cnt,t)
print(t)
from functools import reduce

N = int(input())
A = list(map(int,input().split()))
gcd_max = 0
for i in range(N):
    B = A.copy()
    B[i:i+1] = []
    gcd_max = max(gcd_max,reduce(gcd,B))
print(gcd_max)

### FIXED CODE ###

def gcd(x,y):
    while y != 0:
        x,y = y,x%y
    return x
n = int(input())
a = list(map(int,input().split()))

L,R = [0],[0]
for i in range(1,n+1): #L[i]は左i個,R[i]は右i個
    L.append(gcd(L[-1],a[i-1]))
    R.append(gcd(R[-1],a[n-i]))
print(max(gcd(L[i],R[n-i-1]) for i in range(n)))
n = int(input())
result = 100000
for i in range(0,n):
    result = result * 1.05
    if result % 1000 == 0:
        pass
    else:
        result = result-(result % 1000)+ 1000
        result = result(int)
print(result)

### FIXED CODE ###

n = int(input())
result = 100000
for i in range(0,n):
    result = result * 1.05
    if result % 1000 == 0:
        pass
    else:
        result = result-(result % 1000)+ 1000
        result = int(result)
print(result)
def solve():
    import numpy as np
    import sys

    input = sys.stdin.readline

    h, w = map(int, input().split())
    d = [list(map(int, input().split())) for _ in range(h * 2)]
    for r in range(h):
        for c in range(w):
            d[r][c] = abs(d[r][c] - d[r + h][c])

    MaxBias = 80 * (h + w)

    dp = np.zeros(shape=(h, w, MaxBias + 1))
    dp[0, 0, d[0][0]] = 1

    for r in range(1, h):
        for bias in range(MaxBias + 1):
            if dp[r - 1, 0, bias]:
                for new_bias in abs(bias + d[r][0]), abs(bias - d[r][0]):
                    if 0 <= new_bias <= MaxBias:
                        dp[r, 0, new_bias] = 1

    for c in range(1, w):
        for bias in range(MaxBias + 1):
            if dp[0, c - 1, bias]:
                for new_bias in abs(bias + d[0][c]), abs(bias - d[0][c]):
                    if 0 <= new_bias <= MaxBias:
                        dp[0, c, new_bias] = 1

    for r in range(1, h):
        for c in range(1, w):
            for bias in range(MaxBias + 1):
                if dp[r - 1, c, bias] or dp[r, c - 1, bias]:
                    for new_bias in abs(bias + d[r][c]), abs(bias - d[r][c]):
                        if 0 <= new_bias <= MaxBias:
                            dp[r, c, new_bias] = 1

    for bias in range(MaxBias + 1):
        if dp[h - 1, w - 1, bias]:
            print(bias)
            return


if __name__ == '__main__':
    solve()


### FIXED CODE ###

# https://atcoder.jp/contests/abc147/submissions/8871745
# 写経
# bitset 高速化

def main():
    import numpy as np

    H, W = map(int, input().split())
    A = np.array([[int(x) for x in input().split()] for _ in range(H)])
    B = np.array([[int(x) for x in input().split()] for _ in range(H)])
    D = np.abs(A - B)

    MAX_BIAS_PER_CELL = 80
    UPPER_BOUND_TOTAL_BIAS = MAX_BIAS_PER_CELL * (H + W - 1) + 1

    dp = [[0] * W for _ in range(H)]
    dp[0][0] = 1 << UPPER_BOUND_TOTAL_BIAS
    # dp[r][c]:(r,c)で値の加減を行った後、
    # 達成可能なbiasに該当するbitを立てたbit表現
    # 2**UPPER_BOUND_TOTAL_BIASの位をbias=0とみなす

    # -UPPER_BOUND_TOTAL_BIAS, ..., 0, ...UPPER_BOUND_TOTAL_BIAS [意味するbias]
    # 0, ..., UPPER_BOUND_TOTAL_BIAS, ..., UPPER_BOUND_TOTAL_BIAS*2 [dpに代入されるbit表現の桁]

    # numpyのndarrayを使用しなかった理由
    # dtypeでuint64を採用しても、
    # 2**(UPPER_BOUND_TOTAL_BIAS*2)は収まらない
    # pythonのintなら収まる

    for r in range(H):
        for c in range(W):
            x = dp[r][c]
            if r > 0:
                x |= dp[r - 1][c]
            if c > 0:
                x |= dp[r][c - 1]
            # x:(r,c)到達可能なbiasのbit表現

            d = D[r][c]
            dp[r][c] = (x << d) | (x >> d)
            # (r,c)マスでのbias変化を加味したbit表現

    ret = min(
        abs(UPPER_BOUND_TOTAL_BIAS - shift)
        for shift in range(UPPER_BOUND_TOTAL_BIAS * 2)
        if (dp[H - 1][W - 1] & (1 << shift)) > 0)

    print(ret)


if __name__ == '__main__':
    main()
from math import gcd

def calc_half(n):
    return n//2

def lcm(L):
    ret=1
    for i in range(len(L)):
        ret=(ret*L[i])//gcd(ret,L[i])
    return ret

n,m=map(int,input().split())
A=list(map(int,input().split()))
Auniq=list(set(A))
Ahalf=list(map(calc_half,Auniq))
lcm_ori=lcm(Auniq)
lcm_half=lcm(Ahalf)

if m<lcm_half:
    print("0")
else:
    print(1+(m-lcm_half)//lcm_ori)

### FIXED CODE ###

from fractions import gcd

def calc_half(n):
    return n//2

def lcm(L):
    ret=1
    for i in range(len(L)):
        ret=(ret*L[i])//gcd(ret,L[i])
    return ret

def f(n):
    ret=0
    while n%2==0:
        ret+=1
        n=n//2
    return ret

def g(L):
    l=[]
    for i in L:
        l.append(f(i))
    if len(set(l))==1:
        return False
    else:
        return True

n,m=map(int,input().split())
A=list(map(int,input().split()))
Auniq=list(set(A))
Ahalf=list(map(calc_half,Auniq))
lcm_ori=lcm(Auniq)
lcm_half=lcm(Ahalf)

if m<lcm_half or g(Auniq):
    print("0")
else:
    print(1+(m-lcm_half)//lcm_ori)
a,b =(int(i) for i in input.split())
if a > b:
 print("a > b")
if a == b:
 print("a == b")
if a > b: 
 print("a > b")


### FIXED CODE ###

a,b =map(int, input().split())
if a > b:
 print("a > b")
elif  a == b:
 print("a == b")
else : 
 print("a < b")
import numpy as np
N = int(input())
A = list(map(int,input().split()))
ans = np.argsort(A)+1
for a in ans:
    sys.stdout.write(str(a))
    sys.stdout.write(" ")

### FIXED CODE ###

import numpy as np
import sys
N = int(input())
A = list(map(int,input().split()))
ans = np.argsort(A)+1
for a in ans:
    sys.stdout.write(str(a))
    sys.stdout.write(" ")
n,k=map(int,input().split())
l=[int(i) for i in input().split()]
c=0
mn=min(l)
while len(l)>=1:
  if mn==min(l):
    m=l.index(min(l))
    if m==0:
      l=l[m+1:]
    elif m+l[k-1::-1].index(min(l))==len(l):
      c+=m//(k-1)
      if m%(k-1)!=0:
        c+=1
      l=l[m+1:]
    else:
      c+=1
      l=l[k:]
  else:
    c+=len(l)//(k-1)
    if len(l)%(k-1)!=0:
      c+=1
    l=[]

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
g=1
while k+(k-1)*(g-1)< n:
  g+=1
print(g)
N = int(input())

num = [0]*(10**9)

for x in range(1,int(N**0.5)+1):
    for y in range(1,int(N**0.5)+1):
        for z in range(1,int(N**0.5)+1):
            tmp = x**2 + y**2 + z**2+ x*y + y*z + z*x
            num[tmp] += 1
            
for i in range(1,N+1):
    print(num[i])

### FIXED CODE ###

N = int(input())

from collections import deque
tmp = []
tmp = deque(tmp)
num = [0]*(10**4*7)
for i in range(1,10**2+1):
    tmp.append(i**2)

for x in tmp:
    xx = int(x**0.5)
    for y in tmp:
        yy = int(y**0.5)
        for z in tmp:
            zz = int(z**0.5)
            ans = x + y + z + xx*yy + yy*zz + zz*xx
            num[ans] += 1
            
for i in range(1,N+1):
    print(num[i])
N, Q = map(int, input().split())
A = [''] * (N+1)
C = [0] * (N+1)
for i in range(N-1):
  a, b = map(int, input().split())
  if len(A[a]) == 0:
    A[a] = [b]
  else:
    A[a].append(b)
def AddPX(n, x):
  C[n] += x
  for i in A[n]:
    AddPX(i, x)
  
for i in range(Q):
  p, x = map(int, input().split())
  AddPX(p, x)

print (" ".join(map(str, C[1:])))


### FIXED CODE ###

from collections import deque
from collections import defaultdict
N, Q = map(int, input().split())
C = [0]* N
D = defaultdict(set)
for i in range(N-1):
  a, b = map(int, input().split())
  D[a-1].add(b-1)
  D[b-1].add(a-1)
for i in range(Q):
  p, x = map(int, input().split())
  C[p-1] += x

Q = deque([])
Q.append(0)
vstd = set()

while len(Q)>0:
  a = Q.popleft()
  vstd.add(a)
  for b in D[a]:
    if b in vstd:
      continue
    C[b] += C[a]
    Q.append(b)

print (" ".join(map(str, C)))
s=input()
if(s[0]==s[1] and s[1]==s[2])print("Yes")
else print("No")

### FIXED CODE ###

s=input()
if s[0]==s[1] and s[1]==s[2] :print("No")
else: print("Yes")
a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans= 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      s = 500*i + 100*j + 50*k
      if s==x:
        ans+=1
print(ans)


### FIXED CODE ###

x=int(input())
a=int(input())
b=int(input())
print(x-a-((x-a)//b)*b)
import math
a,b=map(int,input().split())
gcd_ab=math.gcd(a, b)
i=2
d={}
ans=1
while(gcd_ab!=1):
    if(gcd_ab%i == 0):
        val=d.get(i, 0)
        val+=1
        d[i]=val
        gcd_ab//=i
    else:
        i+=1
ans+=len(list(d.keys()))
print(ans)

### FIXED CODE ###

import fractions
a,b=map(int,input().split())
gcd_ab=fractions.gcd(a, b)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

ans=1
ans+=len(set(prime_factorize(gcd_ab)))
print(ans)
import math
n = int(input())
s = [['n' for i in range(10)] for j in range(n)]
for i in range(n):
    s[i]=list(input())
    s[i].sort()
j=0
tans=1
f = 1
ans=0
donei=[]
for i in range(n):
    if not i in donei:
        j=n-1
        while j>i:
            if s[i]==s[j]:
                tans = tans + 1
                donei.append(j)
            j=j-1
        for k in range(tans):
            f = f * (k+1)
        ans = ans + int(f/2)
        tans=1

print(ans)


### FIXED CODE ###

n = int(input())
s = []
for i in range(n):
    s.append(''.join(sorted(input())))
s.sort()
ans = 0
t = 0
for i in range(1,n):
    if s[i-1]==s[i]:
        t += 1
        if i==n-1:
            ans += t*(t+1)/2
    else:
        if t>0:
            ans += t*(t+1)/2
            t = 0

print(int(ans))
x = int(input())

b = 1
p = 2
m = 0

def check(b, p, m):
    if b**p >= m  and b**p <= x:
        print(f"{b}**{p}={b**p}")
        return b**p
    else:
        return m

if x == 1:
    print(1)
else:
    for b in range(x):
        for p in range(x-1):
            m = check(b+1, p+2, m)
    print(m)

### FIXED CODE ###

x = int(input())

m = 0
b = 1
p = 2
ls = []

if x in (1,2,3):
    print(1)
else:
    while b <= x:
        p = 2
        while p <= x:
            if  b**p <= x:
                # print(f"{b}**{p}={b**p}")
                ls.append(b**p)
                p += 1
            else:
                # print(f"break{b}**{p}={b**p}, m{m}")
                break
        b += 1
    print(max(ls))
N = int(input())
A = list(map(int, input().split()))

nums = A[:]
#print(nums)
import math

def cal_gcd(sub_nums):
    gcd_tmp = sub_nums[0]
    for i, v in enumerate(sub_nums):
        if i == 0:
            continue
        gcd_tmp = math.gcd(v, gcd_tmp)
        #print(gcd_tmp)
    return gcd_tmp

ans = 1
import itertools
for v in itertools.combinations(nums, len(nums) - 1):
    #print(v)
    gcd_tmp = cal_gcd(v)
    #print(gcd_tmp)
    ans = max(ans, gcd_tmp)
print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))

nums = A[:]
import fractions

gcd_queue = [
    (nums[0], True),
    (nums[1], True),
    (fractions.gcd(nums[0], nums[1]), False),
]
for n in nums[2:]:
    tmp_queue = []
    for q in gcd_queue:
        if q[1] == True:
            tmp_queue.append((fractions.gcd(q[0], n), True))
        else:
            tmp_queue.append((fractions.gcd(q[0], n), False))
            tmp_queue.append((q[0], True))
    gcd_queue = set(tmp_queue[:])

ans = 0
for q in gcd_queue:
    ans = max(ans, q[0])
print(ans)
N=int(input())
S=list(input())
mod=10**9+7

rl=["L"]
for i in range(1,2*N):
  if S[i]==S[i-1]:
    if rl[i-1]=="R":
      rl.append("L")
    elif rl[i-1]=="L":
      rl.append("R")
  elif S[i]!=S[i-1]:
    if rl[i-1]=="R":
      rl.append("R")
    elif rl[i-1]=="L":
      rl.append("L")

if rl.count("L")!=N or S[0]=="W" or S[2*N-1]=="W":
  print(0)
  exit()

ans=1
for i in range(2*N):
  if rl[i]=="R":
    if rl[:i].count("L")-rl[:i].count("R")<0:
      print(0)
      exit()
    else:
      ans*=(rl[:i].count("L")-rl[:i].count("R"))%mod

for i in range(1,N+1):
  ans=ans%mod*i

print(ans%mod)

### FIXED CODE ###

M,D=list(map(int,input().split()))

cal=[[m+1,d+1] for m in range(M) for d in range(D)]

ans=0
for i in cal:
  day=[(i[1]-i[1]%10)/10,i[1]%10]
  if day[0]>1 and day[1]>1:
    if day[0]*day[1]==i[0]:
      ans+=1

print(ans)
N = int(input())

graph = [[] for i in range(N)]

for i in range(N -1):
    a, b = map(int, input().split())
    graph[a-1].append((b, i))
    graph[b-1].append((a, i))

print(graph)
ans = [0] * (N -1)


def dfs(past, now, color):
    new_color = 1
    for future, edge in graph[now - 1]:
        if future == past:
            pass
        else:
            if new_color == color:
                new_color += 1
            ans[edge] = new_color
            dfs(now, future, new_color)
            new_color += 1

dfs(-1, 1, -1)

print(max(ans))
for i in ans:
    print(i)

### FIXED CODE ###

S = input()

days = ["SUN","MON","TUE","WED","THU","FRI","SAT"]

for i in range(7):
    if days[i] == S:
        print(7 - i)
        break
import numpy as np
N = int(input())
n = N % 2
if n == 1:
  ans = 0
else:
  AB = list(range(N, 1, -2))
  a = int(np.log(N) / np.log(5))
  ab = []
  for i in range(a):
    a5 = 2 * 5 ** (i + 1)
    for Ab in AB:
      if Ab % a5 == 0:
        ab.append(Ab)
  ans = np.sum(ab)
print(ans)

### FIXED CODE ###

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