peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
N = int(input())
a = [int(i) for i in input().split()]


s = sum(a)
m = pow(10, 9)
b = a[0]
for i in range(1, N):
    b += a[i]
    c = s - b
    #print(b)
    #print(c)
    if m > (abs(b-c)):
        m = abs(b-c)

print(m)
# Judge status: Accepted
n = int(input())
s = input()

# E リーダー W
e = 0
w = s[1:].count("W")
ans = e+w
for i in range(1,n):
    if s[i-1] == "E":
        e += 1
    if s[i] == "W":
        w -= 1
    if ans < e + w: ans = e+w
print(n-ans-1)
# Judge status: Wrong Answer
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
x,y=map(int,raw_input().split())
ans= "No"
if x in a and y in b:
  ans= "Yes"
elif x in b and y in b:
  ans = "Yes"
print ans
# Judge status: Wrong Answer
import numpy as np

n = int(input())
a = list(map(int, input().split()))

ind_B = []
for i in range(n):
  B = a[i] - (i + 1)
  ind_B.append(B)

b = sum(ind_B) // len(ind_B)

ABS = []
for j in ind_B:
  abs = np.abs(j - b)
  ABS.append(abs)

sum = sum(ABS)
print(sum)
# Judge status: Wrong Answer
import sys

N = int(input())
AB = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
AB.sort()

n = N // 2 if N % 2 != 0 else N // 2 - 1
left = AB[n][0]

AB.sort(key=lambda x: x[1])
right = AB[n][1]

print(max(0, right - left + 1))
# Judge status: Accepted
K = int(input())
from math import gcd

ans = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):
            ans += gcd(gcd(a, b),c)

print(ans)
# Judge status: Wrong Answer
n, m = map(int,input().split())

aList = []
for i in range(n):
  aList.append(input())

bList = []
for j in range(m):
  bList.append(input())

for k in range(n-(m-1)):
  aIMatch = aList[k].find(bList[0])
  if aIMatch >= 0:
    sucFlag = True 
    for l in range(1,m):
      aNMatch = aList[k+l].find(bList[l])
      if not(aNMatch >= 0 and aIMatch == aNMatch):
        sucFlag = False
        break
    if sucFlag:
      print("Yes")
      exit(0)

print("No")
# Judge status: Accepted
print('NYOE S'[input()in'753'::2])
# Judge status: Accepted
n,l=map(int,input().split())
temp =[]
for i in range(n):
  temp.append(input())
list.sort(temp)

str =""
for s in temp:
  str = str+ s

print(str)
# Judge status: Wrong Answer
input()
bs = list(map(int,input().split()))

def f(bs):
        print(bs)
        if bs == []:
            return 0
        elif bs[0] == 1:
            if len(bs) == 1:
                return 0
            else:
                return int(f([x-1 for x in bs][1:]))
        else:
            return int(1 + f([x for x in bs][1:]))

if 1 not in bs:
    print(-1)
else:
    print(f(bs))
# Judge status: Wrong Answer
N,K = map(int,input().split())
num_list=[]

kari = 0
N -= 1
num_list.append(input().split())
num_list_3 = sorted(num_list)
while(kari != 1):
    count = 0
    N += 1 
    for i in range(K - 1):
        a = num_list_3[0][i]
        s = str(N).count(a)
        print(s)
        if(s != 0):
            count+= 1
            print(count)  
    if (count == 0):
        kari = 1
print(N)
# Judge status: Accepted
n=int(input())
a=0
b=0
while(n>0):
    a+=2**b
    n=n//2
    b=b+1
print(a)
# Judge status: Accepted
X = input()

s, t = 0, len(X)//2
cnt = 0
used = 0
for x in X:
    if x == 'S':
        s += 1
        if t-used > 0:
            cnt += 1
            used += 1
    else:
        used = max(0, used-1)
        t -= 1

print(len(X)-cnt*2)
# Judge status: Accepted
x = int(input())
p = int(x/11)
x -= p*11
if x == 0:
    print(2*p)
elif x >6:
    print(2*p+2)
else:
    print(2*p+1)
# Judge status: Wrong Answer
n,x=map(int,input().split())
a=list(map(int,input().split()))
ans=0
for i in range(1,n):
  temp=max(0,a[i]+a[i-1]-x)
  ans=ans+temp
  a[i]=a[i]-temp
print(ans)
# Judge status: Accepted
weather = input().rstrip()
#print(weather)

if weather.count('RRR') == 1:
    print(3)
elif weather.count('RR') == 1:
    print(2)
elif weather.count('R') >= 1:
    print(1)
else:
    print(0)
# Judge status: Wrong Answer
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n>k:
  print((n-k)*y+x*k)
else:
  print(x*k)
# Judge status: Accepted
import re

s = input()


def isAlpha(value):
    """
    半角英字チェック
    :param value: チェック対象の文字列
    :rtype: チェック対象文字列が、全て半角英字の場合 True
    """
    return re.fullmatch(r"^A([a-z]+)C([a-z]+)", value) is not None


if isAlpha(s):
    print('AC')
else:
    print('WA')
# Judge status: Wrong Answer
N,M=map(int,input().split())
arr=[int(x) for x in input().split()]
s=[list(map(int,input().split())) for y in range(M)]

sum_a=0
for a,b in s:
    arr+=[b]*a
    sum_a+=a
    if sum_a>=N:
        break

lst=sorted(arr)
ans=sum(lst[-N:])
print(ans)
# Judge status: Wrong Answer
a,b,m = map(int,input().split())
A = list(input().split())
B = list(input().split())
X = []
Y = []
C = []
total = 2*10**6
for i in range(m):
    x,y,c = map(int,input().split())
    X.append(x)
    Y.append(y)
    C.append(c)
for i in range(m):
    result = int(A[int(X[int(i)])-1])+int(B[int(Y[int(i)])-1])-int(C[int(i)])
    if (total > result):
        total = result
if(int(min(A))+int(min(B))>result):
    print(result)
else:
    print(int(min(A))+int(min(B)))
# Judge status: Wrong Answer
import sys,math
input = sys.stdin.readline

N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
cnt = 0
num = 0

for i in range(N-1):
  for j in range(D-1):
      num += abs(X[i][j] - X[i+1][j+1]) ** 2
  if int(math.sqrt(num)):
    print(math.sqrt(num))
    cnt += 1

print(cnt)
# Judge status: Wrong Answer

A,B=map(int,input().split())
swapA=A

if A<B:
    A=B
    B=swapA

Anext=A
Bnext=B
amari=1

while amari!=0:
    amari=Anext%Bnext
    if amari==0:
        Bnext=Bnext
    else:
        Anext=Bnext
        Bnext=amari

A=A/Bnext
B=B/Bnext

print(int(A*B))
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    A, B, C = list(map(int, input().split()))
    print(len(set([A, B, C])))


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
import math

n, k = map(int, input().split())
log2 = math.log10( 2)
ans = 0
for i in range(1, n + 1):
    ans += (1 / n) * 0.5 ** math.ceil(math.log10(10 / i) / log2)

print(ans)
# Judge status: Wrong Answer
import math
import itertools
n = int(input())
al = [0] * n
bl = [0] * n
for i in range(n):
    al[i], bl[i] = map(int, input().split())
bunbo = math.factorial(n)
ans = 0
for p in itertools.permutations(list(range(n))):
    print(p)
    for i in range(n-1):
        ans += ((al[p[i+1]]-al[p[i]])**2+(bl[p[i+1]]-bl[p[i]])**2)**0.5
print(ans/bunbo)
# Judge status: Accepted
x, a, b = map(int, input().split())

if abs(x-a) > abs(x-b):
  print("B")
else:
  print("A")
# Judge status: Accepted
# -*- coding: utf-8 -*-

s = str(input())

dic = {'SUN':7, 'MON':6, 'TUE':5, 'WED':4, 'THU':3, 'FRI':2, 'SAT':1}

print(dic[s])
# Judge status: Accepted
def main():
    a, b = map(int, input().split())
    if a % b != 0:
        print(a // b + 1)
    else:
        print(a // b)


if __name__ == "__main__":
    main()
# Judge status: Accepted
import math
x=int(input())
ans=math.gcd(x,360)
print(360//ans)
# Judge status: Accepted
n,m = map(int,input().split())
 
x = []
y = []
 
for _ in range(n):
    a,b = map(int,input().split())
    x.append((a,b))

for _ in range(m):
    c,d = map(int,input().split())
    y.append((c,d))

for i in range(n):
    ans = []
    for j in range(m):
        ans.append(abs(x[i][0]-y[j][0]) + abs(x[i][1]-y[j][1]))
    ind = ans.index(min(ans))
    print(ind + 1)
# Judge status: Accepted
N = int(input())
for i in range(N, 1000):
  if i % 111 == 0:
    print(i)
    break
# Judge status: Wrong Answer
import collections
n=int(input())
S=input()
c=collections.Counter(S)
v=c.values()
ans=1
for vv in v:
  ans*=vv
hiku=0
for i in range(n):
    for d in range(n):
        j=i+d
        k=j+d
        if k>n-1:
            break
        if S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]:
          hiku+=1
print(ans-hiku)
# Judge status: Accepted
import sys
input = sys.stdin.readline
import math
a, b, c = [int(x) for x in input().split()]

c -= (a + b)
if c <= 0:
    print("No")
    sys.exit()

c = c ** 2 - 4 * a * b

if c > 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
S = input()
T = input()
same = lambda x, y: all(True if i == j or i == '?' else False for i, j in zip(x, y))
n = len(T)
for i in range(len(S)-n, -1, -1):
    if same(S[i:i+n], T):
        S = S[:i] + T + S[i+n:]
        break
else:
    print('UNRESTORABLE')
    exit()
print(S.replace('?', 'a'))
# Judge status: Wrong Answer
import math

n, k = map(int, input().split())
A = list(map(int, input().split()))

for i in range(k-1,n+1):
    if i % (k-1) == 1:
        if i == n:
            break
        n += 1

print(math.ceil(n/k))
# Judge status: Accepted
#!/usr/bin/env python3

def main():
    abc = sorted(input().split())
    print(int(abc[2]) * 10 + int(abc[1]) + int(abc[0]))


if __name__ == "__main__":
    main()
# Judge status: Accepted
from itertools import permutations
 
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
 
i = 0
a = 0
b = 0
for s in permutations(range(1, n+1)):
    for j in range(n):
        if p[j] != s[j]:
            break
    else:
        a = i
    for j in range(n):
        if q[j] != s[j]:
            break
    else:
        b = i
    i += 1
 
print(abs(a-b))
# Judge status: Accepted
a,b=map(int,input().split())
x=(a+b)//2
if (a+b)%2==0:
    print(x)
else:
    print(x+1)
# Judge status: Wrong Answer
n=int(input())
s=input()
ans=0
for i in range(1,n-1):
    X=s[:i+1]
    Y=s[i:]
    c=0
    a=list(set(X))
    #print(a)
    for j in range(len(a)):
        if a[j] in Y:
            c+=1
    if c>ans:
        ans=c
print(ans)
# Judge status: Wrong Answer
N = int(input())

res = 0
for i in range(1, N):
    si = str(i)
    for j in range(1, N):
        sj = str(j)
        if si[0] == sj[-1] and si[-1] == sj[0]:
#             print(si, sj)
            res += 1
            
print(res)
# Judge status: Wrong Answer
N,S=int(input()),input()
ans=0
for i in range(N//2):
    a=S[:i+1];b=S[i:]
    c=0;l=[]
    for j in range(i+1):
        if a[j] in b and (not a[j] in l):c+=1;l.append(a[j])
    ans=max(ans,c)
print(ans)
# Judge status: Accepted
import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
A=[int(i) for i in input().split()]
import collections
D=collections.defaultdict(int)
for a in A:
  D[a]+=1
tot=0
for d in D.keys():
  if D[d]>=2:
    tot+=D[d]*(D[d]-1)//2
for a in A:
  ans=tot-D[a]*(D[a]-1)//2+(D[a]-1)*(D[a]-2)//2
  print(ans)
# Judge status: Accepted
S = input()

if S[0] == "A":
    if S[2:-1].count("C") == 1:
        if S[1:].replace("C", "c").islower():
            print("AC")
            exit()

print("WA")
# Judge status: Wrong Answer
a, b, x = map(int, input().split(" "))
a = 0 if a - 1 < 0 else a - 1
ans = b//x - a//x

print(ans)
# Judge status: Wrong Answer
n,m = map(int,input().split())
a = sorted(list(map(int,input().split())),reverse=True)
print("YNeos"[sum([sum(a)/(4*m)<a[i] for i in range(m)])<m::2])
# Judge status: Wrong Answer
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter, deque
#from scipy.misc import comb

N,M = map(int, input().split())

if N <= M//2:
    ans = N + max(M-2*N,0)//4
else:
    ans = M // 4

print(ans)
# Judge status: Wrong Answer
S_list = list(map(int,input().split()))
 
r, g, b = S_list
sum = r+g+b
if sum % 4 == 0 :
    result = "YES"
else:
    result = "NO"
print(result)
# Judge status: Wrong Answer
N=list(input())
ans=0
for i in range(len(N)):
    if i==len(N)-1:
        if len(N)%2==1:
            if len(N)>=2:del N[0]
            s=""
            for num in N:
                s=s+num
            s=int(s)
            if len(N)>=2:
                s+=1
            ans+=s
    else:
        if i%2==0:
            ans+=10**(i+1)-10**i
print(ans)
# Judge status: Accepted
N=int(input())
L=list(map(int,input().split()))
L=sorted(L)
print(L[N//2]-L[N//2-1])
# Judge status: Accepted
a=int(input())
b=int(input())

print(6-a-b)
# Judge status: Accepted
t = int(input())

if (t == 3) or (t == 5) or (t == 7):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
from functools import reduce
def gcd(a, b):
    while b: a, b = b, a % b
    return abs(a)
def lcm(a, b):
    return a*b//gcd(a, b)
N, M = map(int, input().split())
A = [int(a)//2 for a in input().split()]
B = [a & -a for a in A]
if min(B) != max(B):
    print(0)
else:
    l = reduce(lcm, A)
    print(M // l - M // l // 2)
# Judge status: Accepted
from math import floor
def kill(life):
    if life in dp.keys():
        return dp[life]
    if life == 1:
        dp[life] = 1
        return 1
    elif life > 1:
        dp[life] = kill(floor(life/2)) * 2 + 1
        return dp[life]
h = int(input())
dp = {}
print(kill(h))
# Judge status: Wrong Answer
x=int(input())
print(x//11*2+x%11//6+1)
# Judge status: Accepted
N = int(input())

s = 0
ans = set()
for i in range(1, N+1):
    s += i
    ans.add(i)
    if s >= N:
        break

if N < s:
    ans.remove(s-N)

for a in ans:
    print(a)
# Judge status: Accepted
from collections import deque
N = int(input())
S = input().split()
B = deque()

for i in range(N):
  if i%2==0:
    B.append(S[i])
  else:
    B.appendleft(S[i])

if N%2 == 1:
  B.reverse()
print(*B)
# Judge status: Wrong Answer
N = int(input())
A = int(input())
while N > 500:
  N -= 500
if N <= A:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N = int(input())
A =[[0]*10 for i in range(10)]
 
for i in range(1,N+1):
  a = int(str(i)[0])
  b = int(str(i)[-1])
  A[a][b] += 1
 
cnt = 0
for _ in range(1,N+1):
  a = int(str(_)[0])
  b = int(str(_)[-1])
  cnt += A[b][a]
  
print(cnt)
# Judge status: Wrong Answer
n=int(input())
a = list(map(int, input().split()))
a.sort()
al=0
bo=0
for i in range(n):
  if i%2==0:
    al+=a[i]
  else:
    bo+=a[i]
print(al-bo)
# Judge status: Accepted
_ = input()
a_list = list(map(int, input().split()))

can_devide = sum([a%2 for a in a_list])==0
count = 0
while can_devide:
    count += 1
    for i, a in enumerate(a_list):
        a_list[i] = a//2
        
    can_devide = sum([a%2 for a in a_list])==0

print(count)
# Judge status: Accepted
from collections import deque

N = int(input())
S = input()
que = deque(S)
l = r = 0

for s in S:
    if s == '(':
        l += 1
    else:
        r += 1
    if l < r:
        que.appendleft('(')
        l += 1
else:
    ans = "".join(que)
    if r < l:
        ans = ans + ")" * (l - r)
print(ans)
# Judge status: Accepted
def comb(n,k):
    res = 1
    for i in range(1,k+1):
        res *= (n+1-i)
        res //= i
    return res


n,p = map(int, input().split())
a = list(map(int, input().split()))
a = [ai % 2 for ai in a]
odd, even = a.count(1), a.count(0)

ans = 0
for i in range(p,odd+1,2):
    ans += comb(odd, i) * pow(2, even)
print(ans)
# Judge status: Accepted
n, d = map(int, input().split())
cnt = 0
for _ in range(n):
    x, y = map(int, input().split())
    if (x**2+y**2)**0.5 <= d:
        cnt += 1

print(cnt)
# Judge status: Accepted
H,N = map(int,input().split())
A=list(map(int,input().split()))
print("Yes" if sum(A)>=H else "No")
# Judge status: Accepted
S=str(input())
for i in range(len(S)-1,0,-1):
    S=S[:i]
    if len(S)%2==0:
        x=len(S)//2
        if S[:x]==S[x:]:
            print(len(S))
            break
# Judge status: Wrong Answer
n=int(input())
p=list(map(int,input().split()))
cnt=0
for i in range(n):
  if p[i]==i+1:
    cnt += 1
if cnt < n-2:
  print("No")
else:
  print("Yes")
# Judge status: Wrong Answer
x = int(input())
yokin = 100
cnt = 0
while yokin < x:
    yokin *= 1.01
    yokin = yokin//1
    cnt += 1
print(cnt)
# Judge status: Wrong Answer
n = int(input())
a = list(int(input()) for i in range(n))
b = 1
ans = 0
while b != 2 and ans < n-1:
    ans += 1
    b = a[b-1]
if ans > n:
    print(-1)
else:
    print(ans)
# Judge status: Accepted
N=int(input())
S=input()

out=''
for i in range(len(S)):
    if ord(S[i])+N>90:
        out+=chr(ord(S[i])+N-26)
    else:
        out+=chr(ord(S[i])+N)      
   
print(out)
# Judge status: Wrong Answer
n = int(input())
count = 0
for i in range(n):
    a,b = map(int,input().split())
    if a==b:
        count += 1
    else:
        count = 0
print('Yes' if count > 2 else 'No')
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
sum_diffA = 0
sum_diffB = 0
for i, (ai, bi) in enumerate(zip(A,B)):
    sum_diffA += max(bi-ai, 0)
    sum_diffB += max(ai-bi, 0)
if sum_diffA // 2 >= sum_diffB:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N = int(input())


a = -(-N//(10**9))
b = a*10**9-N
List = [0,0,10**9,b,a,1]
  
print(*List)
# Judge status: Accepted
S = input()
if S[0] != 'A':
  print('WA')
elif S[2:-1].count('C') != 1:
  print('WA')
else:
  cindex = S.index('C')
  for i in range(len(S[1:])):
    if i+1 == cindex:
      continue
    if S[i+1].isupper():
      print('WA')
      exit()
  print('AC')
# Judge status: Accepted
N,L = map(int,input().split())
word = []
for x in range(N):
    wd = input()
    word.append(wd)

word_sort = sorted(word)

print("".join(word_sort))
# Judge status: Wrong Answer
x = int(input())
r = 100
ans = 0
while r < x:
  r = int(r * 1.01)
  ans += 1

print(ans)
# Judge status: Accepted
mod = 1000000007

n, m = map(int, input().split())
s = [0] * (n + 2)
for _ in range(m):
    a = int(input())
    s[a] = -1

s[0] = 1
for i in range(0, n):
    if s[i] < 0:
        continue
    if s[i + 1] >= 0:
        s[i + 1] = (s[i + 1] + s[i]) % mod
    if s[i + 2] >= 0:
        s[i + 2] = (s[i + 2] + s[i]) % mod

print (s[n])
# Judge status: Accepted
#!/usr/bin/env python3
# sys.stdin.readline()
import numpy as np
import math
import sys
input = sys.stdin.readline
n,m= map(int,input().split())
A = []
B = []
for i in range(m):
    x,y = map(int,input().split())
    if x==1:
        A.append(y)
    elif y==1:
        A.append(x)
    elif x==n:
        B.append(y)
    elif y==n:
        B.append(x)
s  ="IMPOSSIBLE" if len(set(A + B)) ==len(A)+len(B) else "POSSIBLE"
print(s)
# Judge status: Accepted
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
min = 10000000
j = 0
pos = 0

for i in H:
  j += 1
  if abs(A - (T - 0.006 * i)) < min:
    min = abs(A - (T - 0.006 * i))
    pos = j
print(pos)
# Judge status: Wrong Answer
N = input()
while len(N) > 1:
  sum = 0
  for i in range(1,len(N)+1):
    sum += int(N[-i])
    print(sum)
  N = str(sum)

if int(N) == 9:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
def is_good(mid, key):
    res = 0
    for a in A:
        res += (a + mid - 1) // mid
    return res - N <= key


def binary_search(bad, good, key):
    while good - bad > 1:
        mid = (bad + good) // 2
        if is_good(mid, key):
            good = mid
        else:
            bad = mid
    return good


N, K, *A = map(int, open(0).read().split())
print(binary_search(0, 1_000_000_000, K))
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    s=list(input())
    s.sort()
    if len(set(s))==2 and s[0]==s[1] and s[2]==s[3]:
        print('Yes')
    else:
        print('No')
resolve()
# Judge status: Accepted
#!/usr/bin/env python3
a = int(input())

print(a + a**2 + a**3)
# Judge status: Wrong Answer
a = list(map(int, input().split()))
if max(a) <= 8:
  print("Yay")
else:
  print(":(")
# Judge status: Accepted
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
nn = max(a)
a.remove(nn)
nr = min(a, key=lambda x: abs(x - nn/2))
print(nn, nr)
# Judge status: Accepted
n = int(input())
a = int(input())
if a >= n%500:
	print("Yes")
else:
	print("No")
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
lst=[0]*8
num=0
for i in range(n):
  if 3200<=a[i]:
    num+=1
  for j in range(8):
    if 400*j<=a[i]<400*(j+1):
      if lst[j]==0:
        lst[j]+=1

print(*[max(1,sum(lst)),sum(lst)+num])
# Judge status: Accepted
S = input()


def f(S):
    idx = len(S) // 2
    sub1 = S[:idx]
    sub2 = S[idx:]
    return sub1 == sub2


for i in range(len(S) - 1, -1, -1):
    if f(S[:i]):
        print(i)
        exit()
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
if len(set(a)) == n:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
def main():
  N, M = map(int,input().split())
  sc = list(list(input().split()) for _ in range(M))

  li = [""] * N

  for i in range(M):
    j = li[int(sc[i][0]) - 1]
    if j == "": li[int(sc[i][0]) - 1] = sc[i][1]
    elif j != sc[i][1]: return -1

  for i in range(N):
    if i == 0:
      if li[0] == "0" and N != 1: return -1
      if li[0] == "":
        if N == 1: li[0] = "0"
        else: li[0] = "1"
    elif li[i] == "": li[i] = "0"

  return "".join(li)

print(main())
# Judge status: Accepted
from sys import stdin
input = stdin.readline


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

  if N % 2:
    print(0)
    return

  nz = 0
  i = 1
  while True:
    if N//(5**i)//2 > 0:
      nz += (N//(5**i)//2)
      i += 1
    else:
      break

  print(nz)


if(__name__ == '__main__'):
  main()
# Judge status: Accepted
import math

N = int(input())
A = []
A = input().split()

hantei = True

for i in range(N):
  if int(A[i]) %2 == 0:
    if int(A[i]) % 3 != 0 and int(A[i]) % 5 != 0:
      hantei = False

if hantei == True:
  print('APPROVED')
else:
  print('DENIED')
# Judge status: Accepted
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]
x, y = map(int, input().split())
if x in a and y in a:
    print("Yes")
elif x in b and y in b:
    print("Yes")
elif x == y == 2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())

slist = [0]*4
for i in range(n):
    result = input()

    if result == "AC":
        slist[0]+=1
    if result == "WA":
        slist[1]+=1
    if result == "TLE":
        slist[2]+=1
    if result == "RE":
        slist[3]+=1

print("AC x ",slist[0])
print("WA x ",slist[1])
print("TLE x ",slist[2])
print("RE x ",slist[3])
# Judge status: Wrong Answer
import collections

N = int(input())
cntA = collections.Counter(list(map(int, input().split())))
ans = 0
for num in cntA:
    if num <= cntA[num]:
        ans += cntA[num] - num
    else:
        ans += min(cntA[num], num - cntA[num])
print(ans)
# Judge status: Wrong Answer
import numpy as np
import copy

N = int(input())
X = [int(i) for i in input().split()]

max_value = max(X)
min_value = min(X)

tmp_list = copy.deepcopy(X)
tmp_list.remove(max_value)
max_med = np.median(tmp_list)

tmp_list = copy.deepcopy(X)
tmp_list.remove(min_value)
min_med = np.median(tmp_list)

for i in range(N):
    if X[i] <= max_med:
        print(int(max_med))
    else:
        print(int(min_med))
# Judge status: Wrong Answer
H, N = map(int, input().split())
Ai = (list(map(int,input().split())))

all_damege = 0
for i in Ai:
    all_damege+=i
if H<all_damege:
    print('Yes')
elif H>=all_damege:
    print('No')
# Judge status: Wrong Answer

N,L=map(int,input().split())
#L+i-1,i>=1
nin=10**6
for i in range(N):
    if abs(L+i)<nin:
        nin=abs(L+i)
        nn=L+i

ans=N*(L-1)+N*(N+1)*0.5-(nn)

print(ans)
# Judge status: Wrong Answer
s = input()
N = len(s)

s_first = s[0:(N-1)//2]
s_second = s[(N+1)//2:]

for i in range(len(s_first)):
    if(s_first[i] != s_first[::-1][i] or s_second[i] != s_second[::-1][i]):
        print("No")
        break
else:
    print("Yes")
# Judge status: Accepted
N=int(input())
S=input()
p=10**9+7

from collections import defaultdict
D=defaultdict(int)
num=0
ans=0
dp=[0]*N
dp[0]=2
D[S[0]]+=1
for i in range(1,N):
    s=S[i]
    if D[s]>=1:
        dp[i]=(dp[i-1]+dp[i-1]*pow(D[s]+1,p-2,p))%p
        #print(D[s])
        D[s]+=1
    else:
        dp[i]=dp[i-1]*2%p
        D[s]+=1
#print(dp)
print((dp[-1]-1)%p)
# Judge status: Accepted
s=input()
num=ord(s)
print(chr(num+1))
# Judge status: Accepted
d, n = map(int, input().split())
print(n * (100 ** d) if n < 100 else (n + 1) * (100 ** d) )
# Judge status: Wrong Answer
N, M = map(int, input().split())
L = []
R = []
for _ in range(M):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)
print(min(R) - max(L) + 1)