peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
import collections

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

b = collections.Counter(a)
b=b.most_common()
b.sort()
ans = 1

for i in range(len(b)-2):
    if b[i+2][0]-b[i][0]==2:
        ans=max(ans,b[i][1]+b[i+1][1]+b[i+2][1])
    elif b[i+2][0]-b[i][0]>2 and b[i+1][0]-b[i][0] <= 2:
        ans=max(ans,b[i][1]+b[i+1][1])
    else:
        ans=max(ans,b[i][1])
        
print(ans)
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = input()

    print("Yes") if "9" in n else print("No")


if __name__ == '__main__':
    resolve()
# Judge status: Accepted
from string import ascii_lowercase 

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

  ans = 0

  for i in range(1, N-1):
    left = S[:i]
    right = S[i:]

    letters = []
    for c in ascii_lowercase:
      if(c in left):
        letters.append(c)

    count = 0
    for c in letters:
      if c in right:
        count += 1

    ans = max(ans, count)

  print(ans)

if __name__ == "__main__":
  main()
# Judge status: Accepted
n, m = map(int, input().split())

s = []
e = []
for _ in range(m):
  a, b = map(int, input().split())
  if a == 1:
    s.append(b)
  if b == n:
    e.append(a)

if set(s) & set(e):
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')
# Judge status: Accepted
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter
from operator import mul
from functools import reduce

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

a.sort()

count = Counter(a)

b = [1]*(max(a) + 1)

for aa in a:
    for j in range(2*aa,len(b), aa):
        b[j] = 0

c = 0
for d in count.items():
    if d[1] == 1 and b[d[0]] == 1: c += 1

print(c)
# Judge status: Accepted
l = list(map(int,input().split()))
k = int(input())
l.sort(reverse=True)
for i in range(k):
    l[0] *= 2
print(sum(l))
# Judge status: Wrong Answer
a,s=map(int,input().split())
ans=0
while a<s:
  ans+=1
  a*=2
print(ans)
# Judge status: Wrong Answer
s=sorted(list(set(input())))
alph=[chr(i) for i in range(97,97+26)]
if len(s) == 26:
    print("None")
else:
    for i,j in zip(s,alph):
        if i != j:
            print(j)
            exit()
# Judge status: Wrong Answer
a,b = [int(x) for x in input().split()]
import fractions
g = fractions.gcd(a,b)
ans = 1
flag = 0
mama = int(g**(1/2))
for i in range(2,mama+2):
    while True:
        if g%i != 0:
            break
        else:
            g = g/i
            flag = 1
    if flag == 1:
        ans += 1
    flag = 0
if g == a and ans == 1:
    ans += 1
print(ans)
# Judge status: Accepted
a,b = list(map(int,input().split()))
if (a+b)%2 == 0:
  print((a+b)//2)
else:
  print("IMPOSSIBLE")
# Judge status: Wrong Answer
a, b = map(int, input().split())

sub = 0
for i in range(1, 1000):
    sub += i
    if sub > a:
        print(sub - a)
        break
# Judge status: Accepted
#coding:utf-8
s = input()
#print(int(s[0:3]))
ans = abs(int(s[0:3]) - 753)

for i in range(0, len(s)-2):
    #print(int(s[i:i+3]))
    ans = min(ans, abs(int(s[i:i+3]) - 753))

print(ans)
# Judge status: Wrong Answer
wmax,hmax,n=map(int,input().split())
wmin,hmin=0,0
field=wmax*hmax
for i in range(n):
  x,y,a=map(int,input().split())
  if a==1:
    wmin=max(wmin,x)
  elif a==2:
    wmax=min(wmax,x)
  elif a==3:
    hmin=max(hmin,x)
  elif a==4:
    hmax=min(hmax,x)
print(field-(wmax-wmin)*(hmax-hmin))
# Judge status: Wrong Answer
a, b = list(map(int, input().split(' ')))
def gcd(l, s):
  return l if s == 0 else gcd(s, l % s)

temp = gcd(a, b)

ans = 0
for i in range(2,100000000):
  if temp % i == 0:
    ans += 1
    while temp % i == 0:
      temp = temp // i
  if temp == 1:
    break

print(ans+1)
# Judge status: Accepted
N,M = map(int,input().split())
L = [0 for _ in range(N)]
for i in range(M):
  l,r = map(int,input().split())
  l-=1;r-=1 #0index
  L[l] += 1
  if r+1 < N:
    L[r+1] -= 1
S = [0]
for i in range(N):
  temp = L[i] + S[-1]
  S.append(temp)
#print(S)
ans = 0
for i in range(1,N+1):
  if S[i] == M:
    ans += 1
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in a[::2]:
  if i % 2 == 1:
    ans += 1
print(ans)
# Judge status: Accepted
from collections import deque
n = int(input())
a = list(map(int,input().split()))
b = deque()
for i in range(n):
    if i%2 == n%2:
        b.extend([a[i]])
    else:
        b.extendleft([a[i]])
print(*list(b))
# Judge status: Accepted
x = int(input())
for i in range(x):
    if 100 * i <= x <= 105 * i:
        print(1)
        exit()
print(0)
# Judge status: Wrong Answer
s=sorted(set(input()))
ro='abcdefghijklmnopqrstuvwxyz'
if len(s)==len(ro):
    print('None')
else:
    for i in range(len(s)):
        if s[i]!=ro[i]:
            print(ro[i])
            break
# Judge status: Accepted
a, b, c, x, y = map(int, input().split())
print(min([a*x+b*y, a*(x-min([x,y]))+b*(y-min([x,y]))+2*c*min([x,y]),2*c*max([x, y])]))
# Judge status: Accepted
S = input()
dic = {'a': 0, 'b':0, 'c':0}

for c in S:
    dic[c] += 1

l = [dic['a'], dic['b'], dic['c']]
if max(l)-min(l) <= 1:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
import sys
input = sys.stdin.readline
from collections import defaultdict, deque

(n, m), g = map(int, input().split()), defaultdict(list)
for i in range(m): a, b = map(int, input().split()); g[a].append(b); g[b].append(a)
s, q = [0, 0] + [-1 for i in range(1, n)], deque([1])
for i in range(2, n + 1):
    x = q.popleft()
    for a in g[x]:
        if s[a] == -1: q.append(a); s[a] = x
if not all([a != -1 for a in s]): print('No')
else:
    print('Yes')
    for i in s[2:]: print(i)
# Judge status: Accepted
a,b,c=map(int,input().split())
print('YES' if a+b>=c and a<=c else 'NO')
# Judge status: Wrong Answer
n = int(input())
ai = list(map(int,input().split()))

for i in ai:
    if i%3 == 0 or i%5 == 0:
        print('APPROVED')
else:
    print('DENIED')
# Judge status: Accepted
N, X = map(int, input().split())
L = list(map(int ,input().split()))
D = 0
ans = 1

for i in range(N):
    D += L[i]
    if D > X:
        break
    ans += 1

print(ans)
# Judge status: Accepted
import sys
readline = sys.stdin.readline

def main():
    N, M = map(int, readline().rstrip().split())
    if N == 1 and M == 1:
        print(1)
        return
    if N == 1 or M == 1:
        print(max(N, M) - 2)
        return
    print((N-2) * (M-2))
    return


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

S = input()

while S:
    if S[-1] == 'r':
        if S[-7:] == 'dreamer':
            S = S[:-7]
        elif S[-6:] == 'eraser':
            S = S[:-6]
        else:
            print('NO')
            sys.exit()
    elif S[-5:] == 'dream' or S[-5:] == 'erase':
        S = S[:-5]
    else:
        print('NO')
        sys.exit()

print('YES')
# Judge status: Accepted
from collections import deque
N = int(input())
L = []
for _ in range(N):
  x, l = map(int, input().split())
  L.append([x-l, x+l])
L.sort(key=lambda x: x[1])
L = deque(L)
s, ans = -10**8, 0
while L:
  l = deque.popleft(L)
  if s<=l[0]:
    ans += 1
    s = l[1]
print(ans)
# Judge status: Accepted
n = int(input())
k = int((n * 2) ** 0.5)
while True:
  p = (k+1) * k // 2
  if p >= n: break
  k += 1
diff = abs(n - p)
for i in range(1, k+1):
  if i != diff: print(i)
# Judge status: Accepted
N,M=map(int,input().split())
import heapq
A=list(map(int,input().split()))
heapq.heapify(A)
BC=[]
for i in range(M):
  B,C=map(int,input().split())
  BC.append((B,C))
BC.sort(key=lambda x:x[1],reverse=True)
import bisect
A.sort()
now=0
D=[0]*N
for i in range(M):
  B=BC[i][0]
  C=BC[i][1]
  for j in range(now,min(now+B,N)):
    D[j]=C
  now+=B
  if now>N-1:
    break

for i in range(N):
  a=A[i]
  d=D[i]
  if d>a:
    A[i]=d
  else:
    break
print(sum(A))
# Judge status: Accepted
n = int(input())
line = [0]
for i in range(n):
  line.append(int(input()))
check = [0 for i in range(n+1)]
count = 0
check[1] = 1
a = 1
while True:
  count += 1
  if line[a] == 2:
    break
  else:
    a = line[a]
    check[a] += 1
  
  if check[a] > 1:
    count = -1
    break
print(count)
# Judge status: Wrong Answer
#D
s = int(input())

num = [0,0,1]
for i in range(s-3):
    num = [num[1],num[2],num[0]+num[2]]
    #print(num)
    
print(num[2]%(10**9+7))
# Judge status: Accepted
n = input().split('S')
print(len(sorted(n,key=len, reverse=True)[0]))
# Judge status: Wrong Answer
x =[str(input()) for i in range(2)]
if x[0][0]==x[1][0] and x[0][1]==x[1][1] and x[0][2]==x[1][2]:
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
n, k = map(int, input().split())
print(n%k)
# Judge status: Wrong Answer
n = int(input())
s = sorted(list(int(input()) for _ in range(n)))
ans = sum(s)
i = 0
while ans % 10 == 0:
    ans -= s[i]
    i += 1
    if i == n:
        break
print(ans)
# Judge status: Accepted
from collections import deque
from bisect import bisect_left

n=int(input())
d=deque()
for i in range(n):
  a=int(input())
  b=bisect_left(d,a)
  if b==0:
    d.appendleft(a)
  else:
    d[b-1]=a 
print(len(d))
# Judge status: Accepted
import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    S = input().strip()

    c = collections.Counter(S)
    c2 = collections.Counter()
    ans = min(c['.'], c['#'])

    for i in range(N):
        c2[S[i]] += 1
        ans = min(ans, c2['#'] + c['.'] - c2['.'])

    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
def main():
    n, *a = map(int, open(0).read().split())

    o = sum([i % 2 == 1 for i in a])
    p = sum([i % 4 == 0 for i in a])
    q = sum([i % 2 == 0 for i in a]) - p

    if p + 1 >= o and not q:
        print("Yes")
    elif p >= o and q:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N,A,B = map(int,input().split())
mx = B*(N-1)+A
mn = A*(N-1)+B

print(mx-mn+1)
# Judge status: Accepted
import itertools

n, d = map(int, input().split())
x = []
for _ in range(n):
    xli = list(map(int, input().split()))
    x.append(xli)

cnt = 0
for c in list(itertools.combinations(range(n), 2)):
    total = 0
    for i in range(d):
        total += (abs(x[c[0]][i] - x[c[1]][i])) ** 2
    ans = total ** 0.5
    if ans == int(ans):
       cnt += 1
print(cnt)
# Judge status: Accepted
s = input()
n = len(s)
ok = 0
for i in range(n):
    for j in range(i, n):
        if s[:i] + s[j:] == "keyence":
            ok = 1
if ok == 1:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
n = input()
print(n[0]*len(n))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
money = 1000
stock = 0
for i in range(N-1):
    if A[i+1] > A[i]:
        stock = money // A[i]
        money = money % A[i]
    if A[i+1] < A[i]:
        money += stock * A[i]
        stock = 0
print(stock * A[N-1] + money)
# Judge status: Accepted
N = int(input())
a = list(input().split())
A = [int(a[i])for i in range(N)]
frag = [0 for i in range(60)]
mod = 10 ** 9 + 7
ans = 0

for i in range(60):
    j = 1 << i
    cnt = sum((k & j) >> i for k in A)
    ans += (cnt * (N - cnt)) << i
    ans %= mod
    
print(ans)
# Judge status: Accepted
import math

a, b=(int(x) for x in input().split())

print(int((a*b)/math.gcd(a,b)))
# Judge status: Wrong Answer
N,M = map(int,input().split())
ls = []
for i in range(M):
    P,Y = map(int,input().split())
    ls.append([P,Y,i])
ls.sort()
num = 1
city = ls[0][0]
for i in range(M):
    if ls[i][0] == city:
        ls[i][1] = num
        num += 1
    else:
        num = 1
        ls[i][1] = num
        city = ls[i][0]
ls.sort(key=lambda x:x[2])
for i in range(M):
    print('{0:06d}'.format(ls[i][0])+'{0:06d}'.format(ls[i][1]))
# Judge status: Accepted
h,w,k = map(int,input().split())
for x in range(1001):
    for y in range(1001):
        if w*x + h*y - 2*x*y == k and 0<= x <= h and 0<= y <= w:
            print("Yes")
            exit()
print("No")
# Judge status: Accepted
N,K,X,Y=[int(input()) for i in range(4)]
if N>K:
  print(K*X+(N-K)*Y)
else:
  print(N*X)
# Judge status: Accepted

    
n,m=map(int,input().split())
if(m>n):
    c=m-n
    print(min(c,n))
else:
    if(n%m==0):
        print('0')
    else:
        c=n%m
        print(min(c,m-c))
# Judge status: Accepted
n,k=map(int,input().split())
if n<k:
    if k-n<n:
        print(k-n)
    else:
        print(n)

elif n%k==0:
    print(0)
else:

    a = n // k
    b= (a + 1) * k - n
    c = n - a * k
    t=n-k
    p=k//t
    r=k-p*t
    print(min(b,c,r))
# Judge status: Wrong Answer
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,k = iim()
A = iil()

num = A.index(1)
#if num <= k:
#    print(1+(n-2)//(k-1))
#else:
print((n+k-2)//(k-1))
# Judge status: Accepted
abc = map(int, input().split())

s = set(abc)
print(len(s))
# Judge status: Accepted
N = int(input())
S = input()

print(max([len(set(S[:i]) & set(S[i:])) for i in range(N)]))
# Judge status: Wrong Answer
N=int(input())
List=list(input())
a=0
for i in range(N-1):
    if List[i]=="R":
        pass
    else:
        if List[i+1]=="W":
            pass
        else:
            List[i+1]="W"
            a+=1
print(a)
# Judge status: Accepted
# -*- coding: <encoding name> -*-

n = int(input())
m = int(n ** (1 / 2)) ** 2
print(m)
# Judge status: Accepted
a, b = list(map(int, input().split()))
if a * b % 2:
    print("Odd")
else:
    print("Even")
# Judge status: Accepted
x,y = map(int,input().split())
if x % y == 0:
    print(-1)
else:
    print(x)
# Judge status: Accepted
n,m = map(int, input().split())
judge = [i for i in range(1, m+1)]
ans = [1 for i in range(m)]
for i in range(n):
    a = list(map(int, input().split()))
    a.pop(0)
    for j in judge:
        if not j in a:
            ans[j-1] = 0
print(sum(ans))
# Judge status: Accepted
n,k = map(int,input().split())
a = list(map(int,input().split()))

l = 0
r = 10**10

while r > l + 1:
    m = (r+l)//2
    count = 0
    for i in a:
        if i <= m:
            continue
        count += (i-1)//m
        
    if count > k:
        l = m
    else:
        r = m
    
print(r)
# Judge status: Wrong Answer
a,b,t = map(int,input().split())

print(b*(a//t))
# Judge status: Accepted
N = int(input())
LR = [[0,0] for _ in range(N)]
for i in range(N):
  a,b = map(int, input().split())
  LR[i] = [a-b,a+b]

LR.sort(key=lambda x: x[0])
# print(LR)
prev_right = - 10**9 #一つ前の右端
cnt = 0
for i in range(N):
  if LR[i][0]>=prev_right: #次の左端が前の右端以上なら
    cnt += 1
    prev_right = LR[i][1]
  else:
    if LR[i][1]<prev_right:
      prev_right = LR[i][1]
  # print(prev_right)

print(cnt)
# Judge status: Accepted
x,y=map(int,input().split())
ans=0
if x*y>0:
    if x<=y:
        ans=y-x
    else:
        ans=x-y+2
elif x*y==0:
    if x<=y:
        ans=y-x
    else:
        ans=x-y+1
else:
    ans=abs(abs(x)-abs(y))+1
print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
s=input()
if s[a]=='-' and s.count('-')==1:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
A, B = [int(i) for i in input().split()]

if B < A:
    print(A + B + 1)
else:
    print(A + B)
# Judge status: Accepted
import math
n=int(input())
print(2**int(math.log(n,2)+1)-1)
# Judge status: Accepted
n = int(input())
w = list(map(int, input().split()))
delta = max(w)
for i in range(n):
    c = abs( sum(w[0:i]) - sum(w[i:n]) )
    if c <= delta:
        delta = c
print (delta)
# Judge status: Accepted
N,K = map(int,input().split())
A = list(map(int,input().split()))

B = A.copy()
def update(A):
    res = [0]*N
    for i in range(N):
        if A[i]+i+1<N:
            res[A[i]+i+1] -= 1
        res[max(0,i-A[i])] += 1
    for i in range(N-1):
        res[i+1] += res[i]
    return res

while K:
    B = update(B)
    K -= 1
    if sum(B)==N**2:
        break

print(*B)
# Judge status: Accepted
n = int(input())
csf = [list(map(int, input().split())) for _ in range(n-1)]
 
for i in range(n):
    current = 0
    for j in range(i, n-1):
        if current < csf[j][1]:
            current = csf[j][1]
        if current % csf[j][2] != 0:
            current += csf[j][2] - (current % csf[j][2])
        current += csf[j][0]
    print(current)
# Judge status: Wrong Answer
import math
N, K = map(int, input().split())
print(math.ceil(math.log(N, K)))
# Judge status: Accepted
def main():
    n = int(input())
    ans = 0
    for i in range(1,n+1):
        #print(range(i,n+1,i),sum(range(i,n+1,i)))
        ans += sum(range(i,n+1,i))

    print(ans)
main()
# Judge status: Accepted
S=input()
T=input()
for i in range(0,len(S)):
    if S[-i:]+S[:-i]==T:
        print('Yes')
        exit()
print('No')
# Judge status: Accepted
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    print(6//A//B)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))

color=[]
free=0
count=0
Sans,Mans=0,0
for i in a:
    if i//400<8 and i//400 not in color:
        color.append(i//400)
        Sans+=1
    elif i>=3200:
        free+=1
        
#Mans=Sans
if free+Sans>8:
    Mans=8
else:
    Mans=Sans+free
    
if Sans==0:
    Sans=1
print(Sans,Mans)
# Judge status: Accepted
d=int(input());print("Christmas"+(25-d)*" Eve")
# Judge status: Wrong Answer
def q2():
    N, M = (int(i) for i in input().split())
    A = [int(i) for i in input().split()]
    sum_A = sum(A)
    if N > sum_A:
        ans = N - sum_A
    else:
        ans = 0
    print(ans)


if __name__ == '__main__':
    q2()
# Judge status: Accepted
A, B, C = map(int,input().split())

if (A+B) >= C :
  print("Yes")
else:
  print("No")
# Judge status: Accepted
S = input()
T = input()

if len(S) < len(T):
    print('UNRESTORABLE')
    exit()

ans = 'z'*51
for i in range(len(S)-len(T)+1):
    s = S[i:i+len(T)]
    for a,b in zip(s,T):
        if a==b or a=='?': continue
        break
    else:
        cand = S[:i] + T + S[i+len(T):]
        ans = min(ans, cand.replace('?','a'))

print('UNRESTORABLE' if ans=='z'*51 else ans)
# Judge status: Wrong Answer
n, m = map(int, input().split())
xy = [tuple(map(int, input().split())) for _ in range(m)]

gray = [False] * n
gray[0] = True
ball = [1] * n

for x, y in xy:
    x -= 1; y -= 1
    if ball[x] > 0:
        ball[x] -= 1
        ball[y] += 1
        if gray[x]:
            gray[y] = True


ans = 0
for i in range(n):
    if gray[i] and ball[i] > 0:
        ans += 1
print(ans)
# Judge status: Accepted


n = int(input())
a = [int(input()) for _  in range(n)]


d = {}
for i in a:
    if i not in d:
        d[i] = 0
        d[i] +=1
    elif i in d:
        if d[i] == 0:
            d[i] +=1
        else:
            d[i] -=1
        
        
l =[]
for i in d.keys():
    if d[i] != 0:
        l.append(d[i])
print(len(l))
# Judge status: Accepted
A,B,M = [int(zz) for zz in input().split()]
lia = [int(zz) for zz in input().split()]
lib = [int(zz) for zz in input().split()]

ans = min(lia)+min(lib)
for _ in range(M):
    x,y,c = [int(zz) for zz in input().split()]
    ans = min(ans,lia[x-1]+lib[y-1]-c)

print(ans)
# Judge status: Accepted
input_line = int(input())
deposit = 100
i = 0
while deposit < input_line:
    deposit = int(deposit * 1.01)
    i += 1
print(i)
# Judge status: Accepted
n=int(input())
l=[int(i) for i in input().split()]
c=0
for i in range(n):
    if (i+1)%2==1 and l[i]%2==1:
        c+=1
print(c)
# Judge status: Wrong Answer
import math 
a,b,c,d=map(int,input().split())
print("Yes") if math.ceil(c/a)>=math.ceil(a/d) else print("No")
# Judge status: Accepted
import numpy as np
import math as m

def main(**kwargs):
    r = int(n / 2 + 0.5)
    return r

if __name__ == "__main__":
    cin = np.array(input().split(" ")).astype("int")
    n, *_ = cin

    cout = main(n=n)
    print(cout)
# Judge status: Accepted
from collections import Counter
from itertools import combinations

N = int(input())
if N == 0:
    print(0)
else:
    L = [int(s) for s in input().split()]

    set_L = Counter(L)

    uniq_L = set_L.keys()

    res = 0
    if len(uniq_L) < 3:
        print(res)
    else:
        for Li, Lj, Lk in combinations(uniq_L, 3):
            if Li + Lj > Lk and Li + Lk > Lj and Lj + Lk > Li:
                res += set_L[Li] * set_L[Lj] * set_L[Lk]

        print(res)
# Judge status: Wrong Answer
from math import ceil, floor

N = int(input())

A, B = [], []
for i in range(N):
    _a, _b = [int(x) for x in input().split()]
    A.append(_a)
    B.append(_b)

A.sort()
B.sort()

min_mid, max_mid = 0, 0
if N % 2 != 0:
    mid = int((N-1)/2)
    min_mid, max_mid = A[mid], B[mid]
else:
    mid = int(N / 2)
    min_mid = floor((A[mid-1] + A[mid]) / 2)
    max_mid = ceil((B[mid-1] + B[mid]) / 2)

res = str(max_mid - min_mid + 1)
print(res)
# Judge status: Wrong Answer
from fractions import gcd
from functools import reduce
n = int(input())
l = list(int(input()) for _ in range(n))

def lcm_base(x,y):
  return x*y/gcd(x,y)

def lcm_list(t):
  return reduce(lcm_base,t)
  
print(int(lcm_list(l)))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

b = [abs(i) for i in a]

if (sum([i < 0 for i in a]) + sum([i == 0 for i in a]))% 2 == 0:
    print(sum(b))
else:
    b = [abs(i) for i in a]
    a0 = a.pop(0)
    af = a.pop()
    print(sum(b) - min(abs(a0), abs(af)) * 2)
# Judge status: Wrong Answer
def chmin(a, b):
  if a > b:
    return b
  return a

def main():
  N = int(input())
  hs = [i for i in map(int, input().split())]
  
  dp = [1e5]*100010
  dp[0] = 0
  for i in range(1, N):
    dp[i] = chmin(dp[i], dp[i-1] + abs(hs[i]-hs[i-1]))
    if i > 1:
      dp[i] = chmin(dp[i], dp[i-2] + abs(hs[i]-hs[i-2]))
  print(dp[N-1])

if __name__ == '__main__':
  main()
# Judge status: Wrong Answer
import sys
import math
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def Main():
    a,b,n = IL()
    x = min(b,n)
    print(math.floor(a*x/b)-a*math.floor(x/b))
    return

if __name__=='__main__':
    Main()
# Judge status: Accepted
#!/usr/bin/env python
# coding: utf-8

# In[1]:


S = input()


# In[4]:


f = True
s_reversed = S[::-1]
words = ['maerd', 'remaerd', 'esare', 'resare']
while s_reversed:
    length = len(s_reversed)
    for i in [7,6,5]:
        while s_reversed[:i] in words:
            s_reversed = s_reversed[i:]
    if length == len(s_reversed):
        print("NO")
        f = False
        break
if f:
    print("YES")


# In[ ]:
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split(" ")))
A.sort()
same = False
for i in range(N - 1):
  if A[i] == A[i + 1]:
    same |= True
print('NO' if same else 'YES')
# Judge status: Accepted
import fractions

N, X = list(map(int,input().split()))
x = list(map(int,input().split()))
x.append(X)
x = sorted(x)

difs=[]
for i in range(N):
    difs.append(x[i+1] - x[i])

    if i == 0:
        ans = difs[0]
        continue

    ans = fractions.gcd(ans, difs[i])

print(ans)
# Judge status: Accepted
N = int(input())
Cash = sorted([1]+[6**T for T in range(1,7)]+[9**T for T in range(1,6)])
DPList = [0]*(N+1)
for TN in range(1,N+1):
    DPList[TN] = min(DPList[TN-TC]+1 if TN>=TC else 1000000 for TC in Cash)
print(DPList[N])
# Judge status: Wrong Answer
#(0)入力環境
import bisect#listをsortしたまま要素を挿入できる
n = int(input())
l = sorted(list(map(int,input().split())))

#(1)考察
#aとbの二重ループのなかで最後の一つは二分探索で高速に
ans = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        ans += bisect.bisect_left(l,l[i] + l[j]) - (j + 1)
        print(ans)

print(ans)