peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
def main():
    N = int(input())
    p_list = [list(map(int, input().split())) for i in range(N)]

    z_list = []
    w_list = []
    for i in range(N):
        x = p_list[i][0]
        y = p_list[i][1]
        z_list.append(x + y)
        w_list.append(x - y)
    ans = max(max(z_list) - min(z_list), max(w_list) - min(w_list))
    print(ans)
    return


if __name__ == '__main__':
    main()
# Judge status: Accepted
n,m = map(int,input().split())
d = {str(x):[] for x in range(1,n+1)}
n = str(n)
ans = "IMPOSSIBLE"
for i in range(m):
    t = input().split()
    d[t[0]].append(t[1])

for l1 in d["1"]:
    if l1==n:
        ans="POSSIBLE"
        break
    else:
        for l2 in d[l1]:
            if l2==n:
                ans="POSSIBLE"
                break
print(ans)
# Judge status: Accepted
n = int(input())
items = list(map(int, input().split()))
count = 0
while True:
    should_break = False
    for i in range(n):
        if items[i] % 2 == 0:
            items[i] = items[i] / 2
            continue
        else:
            should_break = True
            break
    if should_break:
        break
    count += 1
print(count)
# Judge status: Accepted
N, K = map(int, input().split())
S = input()
ans = 0
for i in range(1, N):
    if S[i] == S[i-1]:
        ans += 1

print(min(N-1, ans+2*K))
# Judge status: Accepted
n = int(input())
li = list(map(int,input().split()))
li_ans = list(enumerate(li))
li_sorted = sorted(li_ans,key = lambda x :x[1])
ans =[str(x[0]+1) for x in li_sorted]
print(' '.join(ans))
# Judge status: Accepted
a,b,c=map(int,input().split())
m=max(a,b,c)*3
if (m-a-b-c)&1:m+=3
print((m-a-b-c)//2)
# Judge status: Wrong Answer
N = int(input())

A = [list(map(int, input().split())) for _ in range(N)]

list = []

for i in range(N):
    list.append(A[i][0])
    list.append(A[i][1])

list.sort()


if(N%2 == 1):
    ans = list[N+1] - list[N-2] + 1

else:
    temp = list[N+1] - list[N-2] + 1
    ans = temp*(temp - 1)//2

print(ans)
# Judge status: Accepted
r = int(input())

print(int(r**2))
# Judge status: Accepted
n = int(input())
kuku = {a * b for a in range(1, 10) for b in range(1, 10)}

for i in kuku:
    if n == i:
        print('Yes')
        exit()

print('No')
# Judge status: Accepted
N,A,B = list(map(int,input().split()))


tmp = []

for num in range(1,N+1):
    i = 0
    for n in list(str(num)):
        i += int(n)

    if A <= i <= B:
        tmp.append(num)

ans = 0

for t in tmp:
    ans += t

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

dif = []

for i in range(len(s)-3):
    dif.append(abs(753-int(s[i:i+3])))

print(min(dif))
# Judge status: Accepted
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0

for i in range(n):
    s = input()
    if s == 'AC':
        ac += 1
    elif s == 'WA':
        wa += 1
    elif s == 'TLE':
        tle += 1
    else:
        re += 1

print('AC x', ac)
print('WA x', wa)
print('TLE x', tle)
print('RE x', re)
# Judge status: Accepted
a = int(input())
s = input()
if a >= 3200: print(s)
else: print('red')
# Judge status: Accepted
import sys
input = sys.stdin.readline
dic = {}
dic["a"] = list(input().rstrip())
dic["b"] = list(input().rstrip())
dic["c"] = list(input().rstrip())
next_ = dic["a"].pop(0)
while len(dic["a"]) >= 0 and len(dic["b"]) >= 0 and len(dic["c"]) >= 0:
    if len(dic[next_]) == 0:
        print(next_.upper())
        sys.exit()
    next_ = dic[next_].pop(0)
# Judge status: Accepted
S = input()

if len(S) == len(set(S)):
    print('yes')
else:
    print('no')
# Judge status: Accepted
X,Y,Z = map(int, input().split())
answer = (X-Z) // (Y+Z)

print(answer)
# Judge status: Wrong Answer
n,m=map(int,input().split())
if n>=3 and m>=3:
  print((n-2)*(m-2))
elif n==1 or m==1:
  print(n*m-2)
else:
  print(0)
# Judge status: Wrong Answer
def resolve():
    N = int(input())
    ans = 0
    for i in range(1, N+1):
        if not (i%3 == 0 or i%5==0):
            ans += i
    print(ans)
# Judge status: Accepted
n,p = map(int, input().split())
a = list(map(int, input().split()))

odd = 0
even = 0

for i in range(n):
  if a[i]%2 == 0:
    even += 1
  else:
    odd += 1

if odd == 0:
  if p == 1:
    print(0)
  else:
    print (2**n)
else:
  print (2**(n-1))
# Judge status: Accepted
import decimal
a, b = (decimal.Decimal(x) for x in input().split())
print(int(a*b))
# Judge status: Accepted
N,M=map(int,input().split())
MOD=int(1e9)+7
if abs(N-M)>1:
    print(0)
else:
    fn=1;fm=1;
    for i in range(2,N+1):
        fn=(fn*i)%MOD
    for i in range(2,M+1):
        fm=(fm*i)%MOD
    if abs(N-M)==0:
        print((fn*fm*2)%MOD)
    else:
        print((fn*fm)%MOD)
# Judge status: Accepted
n,k,q = map(int, input().split())
al = [0]*n
for i in range(q):
    al[int(input())-1]+=1
for i in al:
    print('Yes' if k-q+i>0 else 'No')
# Judge status: Wrong Answer
N = int(input())
dic = {}
L = list(map(int, input().split()))
L.sort()
s = 0
for i in range(0, len (L)):
    for j in range(i+1 , len (L)):
        for k in range ( j+1 ,len(L)):
            if L[i] > k:
                s+=1
print (s)
# Judge status: Wrong Answer
r,g,b = map(int,input().split())
rgb = int( r + g + b )
print( 'Yes' if rgb % 4 == 0 else 'NO' )
# Judge status: Accepted
#a
n = int(input())
aa = []
bb = []

for i in range(n):
    a,b = [int(j) for j in input().split()]
    aa.append(a)
    bb.append(b)

cnt = 0
for i in range(n-1,-1,-1):
    a = aa[i] + cnt
    b = bb[i]
    
    r = a%b
    add = (b-r)%b
    cnt += add

print(cnt)
# Judge status: Wrong Answer
N, K = map(int, input().split())
H = [int(input()) for _ in range(N)]
H.sort()
minim = 1e10
for i in range(N-K):
    print(H[i], H[i+K-1])
    minim = min(minim, H[i+K-1] - H[i])
print(minim)
# Judge status: Wrong Answer
def main():
    n = int(input())
    a = list(map(int, input().split()))
    s, cnt = [0]*n, 0
    for i in range(n):
        s[i] = abs(a[i])
        if i < 0:
            cnt += 1
    if cnt%2:
        print(sum(s) - 2*min(s))
    else:
        print(sum(s))

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0

for i in range(a):
  for j in range(b):
    for k in range(c):
      if 500*i+100*j+50*k == x:
        ans +=1
        
print(ans)
# Judge status: Accepted
# row = [int(x) for x in input().rstrip().split(" ")]
# n = int(input().rstrip())
# s = input().rstrip()

def resolve():
    import sys
    input = sys.stdin.readline

    n = int(input().rstrip())

    count = 0
    ans = 0
    for a in input().rstrip().split(" "):
        a = int(a)
        if a == count + 1:
            count+= 1
        else:
            ans += 1

    if count == 0:
        print("-1")
    else:
        print(ans)

if __name__ == "__main__":
    resolve()
# Judge status: Accepted
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")

n,c,k = list(map(int, input().split()))
ts = [None]*n
for i in range(n):
    ts[i] = int(input())
ts.sort()
ans = 0
last = -float("inf")
num = 0
for t in ts:
    if last<t or num==c:
        last = t+k
        num = 1
        ans += 1
    else:
        num += 1
print(ans)
# Judge status: Accepted
D, N = map(int, input().split())
print(N*(100**D) if N != 100 else (N + 1)*(100**D))
# Judge status: Accepted
S = input()

if len(S) % 2 != 0:
    print('No')
    exit()

tmp = [S[i:i+2] for i in range(0, len(S), 2)]

for s in tmp:
    if s != 'hi':
        print('No')
        exit()

print('Yes')
# Judge status: Accepted
A, B = map(int, input().split())
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
N = gcd(A,B)

def factorize(n):
  b = 2
  fct = []
  while b * b <= n:
    while n % b == 0:
      n //= b
      fct.append(b)
    b = b + 1
  if n > 1:
    fct.append(n)
  return fct

print(len(set(factorize(N)))+1)
# Judge status: Accepted
N = int(input())
ab = []
for i in range(N):
    ab.append(tuple(map(int,input().split())))
 
up = sorted(ab,key=lambda a:a[1])
down = sorted(ab,key=lambda a:a[0])
 
if N%2 == 1:
    print(up[N//2][1]-down[N//2][0]+1)
else:
    up2 = sorted(ab,key=lambda a:a[1],reverse=True)
    down2 = sorted(ab,key=lambda a:a[0],reverse=True)
    r = (up[N//2][1]+up2[N//2][1])
    l = (down[N//2][0]+down2[N//2][0])
    print(r-l+1)
# Judge status: Accepted
X,N = map(int,input().split())
if N>0:
  p=list(map(int,input().split()))
  for d in range(0,101):
    if (X-d) not in p:
      print(X-d)
      break
    elif (X+d) not in p:
      print(X+d)
      break
else:print(X)
# Judge status: Accepted
N = int(input())
S = input()
x = 0
ans = x

for i in range(N):
    if S[i]=="I":
        x += 1
        ans = max(ans, x)
    else:
        x -= 1
print(ans)
# Judge status: Accepted
N = int(input())
s = 0
k = 0
l = 0
count = 0
for i in range(N):
  t, x, y = map(int, input().split())
  if t-s >= abs(x - k) + abs(y - l) and (t - s - (abs(x - k) + abs(y - l))) % 2 == 0:
    s = t
    k = x
    l = y
  else:
    count += 1
if count > 0:
  print('No')
else:
  print('Yes')
# Judge status: Wrong Answer
a = int(input())
z = input()

print(z[0:a] + "...")
# Judge status: Wrong Answer
a,b=map(int,input().split())
c=input().split()
if sum(int(i) for i in c)>a:
    print(-1)
else:
    print(a-sum(int(i)) for i in c)
# Judge status: Wrong Answer
N = int(input())
ans = N
for i in range(N):
  cc = 0
  t = i
  while t > 0:
    cc += t%6
    t = int(t/6)
  t = N - i
  
  while t > 0:
    cc += t%9
    t = int(t/9)
  if ans > cc:
    ans = cc

print(ans)
# Judge status: Wrong Answer
import copy
from fractions import gcd

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

Answer = 1
if N == 2:
    Answer = max(ListA[0],ListA[1])
else:
    for j in range(N):
        Lista = copy.deepcopy(ListA)
        Lista.pop(j)
        GCDa = gcd(Lista[0],Lista[1])
        for i in range(N-1):
            GCDa = gcd(Lista[i],GCDa)
            if GCDa == 1:
                continue
            Answer = max(GCDa,Answer)

print(Answer)
# Judge status: Accepted
n=int(input())
ans=1
for i in range(7):
    if 2**i <= n:
        ans=2**i
print(ans)
# Judge status: Accepted
x = int(input())
i = 0
tmp = 0
while tmp < x:
    tmp += i + 1
    i += 1
print(i)
# Judge status: Accepted
a, b = map(int, input().split())
print((b-a)*(b-a+1)//2-b)
# Judge status: Accepted
N,A,B=map(int, input().split())
if abs(A-B)%2==0:
  print( abs(A-B)//2 )
else:
  if N-B > A-1:
    print( A-1+1+(B-A-1)//2 )
  else:
    print( N-B+1+(B-A-1)//2 )
# Judge status: Wrong Answer
from math import log2

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

r = 0
for i in range(1,N+1):
    if i >= K:
        r += 1.0
        continue
    count = int(log2(K / i)) + 1
    r += (1.0 / (2 ** count))
r = r / N

print(r)
# Judge status: Accepted
S = input()
if (S[2]==S[3])&(S[4]==S[5]):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    ans=10**18
    for i in range(1,n):
        x=sum([int(j) for j in str(i)])+sum([int(j) for j in str(n-i)])
        ans=min(ans,x)
    print(ans)
resolve()
# Judge status: Accepted
a = list()
a[0:2] = map(int, input().split())
a[3:5] = map(int, input().split())
a[6:8] = map(int, input().split())
n = int(input())
for i in range(n):
    b = int(input())
    if b in a:
        a[a.index(b)] = 0
for i, j, k in ((0, 1, 2), (3, 4, 5), (6, 7, 8), (0, 3, 6), (1, 4, 7), (2, 5, 8), (0, 4, 8), (2, 4, 6)):
    if a[i] == a[j] == a[k] == 0:
        print("Yes")
        exit()
print("No")
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))

res = 0
for i in range (1, n):
    cur = a[i] - a[i - 1]
    if cur > 0:
        res += cur
print(res)
# Judge status: Wrong Answer
N = int(input())

alphabets = 'abcdefghijklmnopqrstuvwxyz'

def dfs(s, max_idx):
  if len(s) == N:
    print(s)
    return
  else:
    for i in range(0, max_idx+1):
      t = s
      t = t + alphabets[i]
      dfs(t, max(i, max_idx)+1)
    
dfs("", 0)
# Judge status: Accepted
import statistics
n = int(input())
a = list(map(int,input().split()))
A = [0]*n
sad = 0
for i in range(1,n+1):
    A[i-1] = a[i-1]-i

A.sort()
b = int(statistics.median(A))
sad = sum(abs(A[i-1]-b) for i in range(1,n+1))
print(sad)
# Judge status: Accepted
s=input()
if 'N' in s and not 'S' in s:
  print('No')
elif 'S' in s and not 'N' in s:
  print('No')
elif 'W' in s and not 'E' in s:
  print('No')
elif 'E' in s and not 'W' in s:
  print('No')
else:
  print('Yes')
# Judge status: Wrong Answer
S = input()
flag = True
if S[0] != 'A':
    flag = False

cnt = 0
for i in range(2, len(S) - 1):
    if S[i].isupper() == True:
        cnt += 1

if cnt >= 3:
    flag = False

if 'C' not in S[2 : len(S) - 1]:
    flag = False

print('AC' if flag == True else 'WA')
# Judge status: Accepted
#31
import sys
S = input()
l = len(S)

for i in range(l):
    cou = 0
    for j in range(l):
        if S[i] == S[j]:
            cou +=1
    if cou == 2:
        print("no")
        sys.exit()
print("yes")
# Judge status: Wrong Answer
from collections import Counter

n = int(input())
s = [None] * n
for i in range(n):
    s[i] = input().rstrip()

m = int(input())
t = [None] * m
for i in range(m):
    t[i] = input().rstrip()

ctr = Counter(s) - Counter(t)
if ctr:
    print(ctr.most_common(1)[0][0])
else:
    print(0)
# Judge status: Accepted
def main():
    a = int(input())
    b = int(input())
    h = int(input())
    print(int((a + b) * h / 2))

if __name__ == "__main__":
  main()
# Judge status: Accepted
n,p=map(int,input().split())
a=list(map(int,input().split()))
z=o=0
for i in a:
  if i&1:o+=1
  else:z+=1
if o==0:
  if p==1:print(0)
  else:print(2**n)
else:print(2**(n-1))
# Judge status: Accepted
print("AB"+"CD"[len(input())==4])
# Judge status: Accepted
N, K = map(int, input().split())
enemy = sorted(map(int, input().split()))
if N <= K:
  print(0)
else:
  print(sum(enemy[:N-K]))
# Judge status: Accepted
n,*l=map(int,open(0).read().split())
c=p=m=0
for i in l: c=-~c*(i<=p); m=max(m,c); p=i
print(m)
# Judge status: Accepted
n,k = map(int, input().split())
A = [int(x) for x in input().split()]
d = {}
for a in A:
  if a in d:
    d[a] +=1
  else:
    d[a] =1
    
d =sorted(d.values())
if len(d) > k:
  ans = 0
  for i in range(len(d)-k):
    ans += d[i]
  print(ans)
else:
  print(0)
# Judge status: Accepted
S = input()
N = len(S)
ans = 1
i = 1
prev_two = 0
while i < N:
    if prev_two:
        i += 1
        prev_two = 0
    elif S[i] == S[i-1]:
        i += 2
        prev_two = 1
    else:
        i += 1
    ans += 1
if i == N+1:
    ans -= 1
print(ans)
# Judge status: Wrong Answer
k=int(input())
if k%2==0:
    print((k/2)**2)
else:
    print(int((k//2)*(k//2+1)))
# Judge status: Accepted
def resolve():
    N, X, Y = list(map(int, input().split()))
    X -= 1
    Y -= 1
    dists = [[0 for _ in range(N)] for __ in range(N)]
    for i in range(N):
        for j in range(i+1, N):
            dists[i][j] = min(j-i, abs(X-i)+abs(Y-j)+1)
    counts = [0 for _ in range(N)]
    for i in range(N):
        for j in range(i+1, N):
            counts[dists[i][j]] += 1
    for i in range(1, N):
        print(counts[i])


if '__main__' == __name__:
    resolve()
# Judge status: Accepted
import string
def num():
    return int(input())
def nums():
    return list(map(int,input().split()))


if "7" in input():
    print("Yes")
else:
    print("No")
# Judge status: Accepted
AB,BC,CA=map(int,input().split())
print(AB*BC//2)
# Judge status: Accepted
n = int(input())
v = list(map(int, input().split()))
sort_v = sorted(v)
ans = sort_v[0]
for i in sort_v[1:]:
    ans = (ans + i)/2
print(ans)
# Judge status: Wrong Answer
n,m=map(int,input().split())
flag=list(1 for _ in range(n+1))
count=list(0 for _ in range(n+1))
ans=0
for i in range(m):
    x=int(input())
    flag[x]=0
print(flag)

if n==1:
    ans=1
else:
    if flag[1]==1:
        count[1]=1
    if flag[2]==1:
        count[2]=count[1]+1
    for i in range(3,n+1):
        if flag[i]==1:
            count[i]=count[i-1]+count[i-2]
            
    ans=count[n]
print(ans%(10**9+7))
# Judge status: Accepted
a = int(input())

b = (1000-a%1000)%1000

print(b)
# Judge status: Accepted
a,b,x = map(int, input().split())
print((b//x) - ((a-1)//x))
# Judge status: Accepted
import math as m
A,B,H,M = map(int,input().split())
hour_angle =(30*H+0.5*M)
minute_angle =(6*M)
hour_X = float('{:.12f}'.format(m.sin(m.radians(hour_angle))))*A
hour_Y = float('{:.12f}'.format(m.cos(m.radians(hour_angle))))*A
minute_X = float('{:.12f}'.format(m.sin(m.radians(minute_angle))))*B
minute_Y = float('{:.12f}'.format(m.cos(m.radians(minute_angle))))*B
#print(hour_X,hour_Y,minute_X,minute_Y)
print(m.sqrt((hour_X-minute_X)**2+(hour_Y-minute_Y)**2))
# Judge status: Accepted
import math
h,a=map(int,input().split())

print(math.ceil(h/a))
# Judge status: Wrong Answer
N, K = map(int, input().split())
A = list(map(int, input().split()))

j = 1
lis = [1]
loop = 0
for i in range(K):
    j = A[j-1]
    if not j in lis:
        lis.append(j)
    else:
        n = lis.index(j)
        loop = len(lis) - n
        break

if loop == 0:
    print(j)
else:
    print(A[n + (K - len(lis)) % loop])
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a>=13:
    print(b)
if a>=6:
    print(b//2)
else:
    print(0)
# Judge status: Wrong Answer
import sys
from collections import Counter

input = sys.stdin.readline

N = int(input())
ans = 1
mod = 998244353
D = list(map(int, input().split()))
if D[0] != 0:
    print(0)
    exit()
D = sorted(Counter(D).items())
tmp = D[0][1]
stream = 0
for n, i in D:
    if stream != n:
        print(0)
        exit()
    if n == 0 and i == 1:
        stream += 1
        continue
    else:
        print(0)
        exit()
    ans *= pow(tmp, i)
    ans %= mod
    tmp = i
    stream += 1
print(ans)
# Judge status: Wrong Answer
N,K=map(int,input().split())
A=list(map(int,input().split()))

dictS={}
dictS[0]=1

P=20988936657440586486151264256610222593863921
# P=10**9+7


for n in range (1,N+1):
    if n-1<K:
        dictS[n]=(A[n-1]*dictS[n-1])%P
    else:
        dictS[n]=(A[n-1]*dictS[n-1]/A[n-1-K])%P

    if n>K:
        if dictS[n]>dictS[n-1]:
            print('Yes')
        else:
            print('No')
# Judge status: Wrong Answer
L =[]
for i in range(3):
    a,b,c = map(int,input().split())
    L.append([a,b,c])

#print(L)
n = int(input())
li = []
for i in range(n):
    li.append(int(input()))
flag = False
for i in range(3):
    for j in range(3):
        if L[i][j] in li:
            flag = True
    if flag :
        print("Yes")
        exit()
for j in range(3):
    for i in range(3):
        if L[i][j] in li:
            flag = True
    if flag:
        print("Yes")
        exit()
print("NO")
# Judge status: Accepted
W, H, x, y = map(int, input().split(' '))

if 2 * x == W and 2 * y == H:
    print(W * H / 2, 1)
else:
    print(W * H / 2, 0)
# Judge status: Wrong Answer
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]
for i in range(n):
    ans, ans1 = 0, 0
    for j in range(n):
        if s[i] == s[j]:
            ans1 += 1
    for k in range(m):
        if s[i] == t[k]:
            ans1 -= 1
    ans = max(ans, ans1)
print(ans)
# Judge status: Accepted
mod=10**9+7
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a=ii()
if a%2==0:
  b=a//2
  print(b*(a-1))
else:
  b=(a-1)//2
  print(a*b)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))

L=sum(A)
X=0
M=float("inf")
for i in range(N-1):
    X+=A[i]
    M=min(M,abs(2*X-L))
print(M)
# Judge status: Accepted
# 問題: https://atcoder.jp/contests/abc144/tasks/abc144_b

n = int(input())
has_multiple = False
for a in range(1, 10):
    if n % a > 0:
        continue
    b = n / a
    if 0 < b < 10:
        has_multiple = True
        break

if has_multiple:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
def main():
    s, w = map(int, input().split())
    if w >= 0:
        print("unsafe")
    else: print("safe")


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N = int(input())
W=[]
ss=True
for i in range (N):
  W.append(input())


if len(W)!=len(set(W)):   
  print("No")
  exit()

for t in range (1,N):
    if W[t-1][-1]==W[t][0]:
      ss=True
    else:
      ss=False 
     
      

     
if ss==False:
  print("No")
else:
  print("Yes")
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)

print(sum(a[1::2][:N]))
# Judge status: Accepted
n = int(input())

ans = 0
for i in range(1, n+1):
  cnt = 0
  for j in range(1, i+1):
    if i % j == 0: cnt += 1
  ans += i&1 and cnt == 8
print(ans)
# Judge status: Accepted
n=int(input())

minl=[]
maxl=[]
for i in range(n):
  k=input().split()
  minl.append(int(k[0]))
  maxl.append(int(k[1]))
  
minl.sort()
maxl.sort()

if n%2==1:
  c=int((n+1)/2)-1
  re=maxl[c]-minl[c]+1
else:
  c2=int(n/2)
  c1=c2-1
  re=(maxl[c1]+maxl[c2])-(minl[c1]+minl[c2])+1
  
print(re)
# Judge status: Wrong Answer
import sys
def main():
  input = sys.stdin.readline
  maxa=0
  N=int(input())
  L=list(map(int,input().split()))
  c=[0]*100000
  for i in L:
    c[i-1]+=1
  R=tuple(set(L))
  for i in range(1,99999):
    s=c[i]+c[i-1]+c[i+1]
    maxa=max(maxa,s)
  print(maxa)
if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
cnt=0
set_alist=list(set(a))
for i in range(len(set_alist)):
  acount=a.count(set_alist[i])
  if acount>set_alist[i]:
    cnt+=acount-set_alist[i]
  else:
    cnt+=acount
  
print(cnt)
# Judge status: Wrong Answer
a,b = map(int,(input().split()))

if a > 11 or b > 11:
    print(":( ")
else:
    print("Yay!")
# Judge status: Wrong Answer
a,b,c = map(int,input().split())

print(max(0,c-a-b))
# Judge status: Accepted
a,b,c = map(int, input().split())
if (c>=a and c<=b):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N, M = map(int, input().split())

if N == 1:
    if M == 1:
        print(1)
    else:
        print((N-2)*(M-2)*(-1))
else:
    if M == 1:
        print((N-2)*(M-2)*(-1))
    else:
        print((N-2)*(M-2))
# Judge status: Wrong Answer
N = int(input())
A = int(input())
N_last = N % 500
if N_last < A :
    print("Yes")
else :
    print("No")
# Judge status: Wrong Answer
n = int(input())
l = [2,1]
l = l + [0]*(n-1)
if n == 1:
  print(1)
for i in range(2,n+1):
  l[i] = l[i-2] + l[i-1]
print(l[n])
# Judge status: Accepted
import itertools
N, M, Q = map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(Q)]
M_chr = []
for i in range(1,M+1):
    M_chr.append(i)
As = list(itertools.combinations_with_replacement(M_chr, N))
pointA_max = 0
for i, A in enumerate(As):
    pointA = 0
    for i in range(Q):
        if A[abcd[i][1]-1]-A[abcd[i][0]-1] == abcd[i][2]:
            pointA = pointA + abcd[i][3]
    if pointA_max < pointA:
        pointA_max = pointA
print(pointA_max)
# Judge status: Accepted
a,b,c = map(int, input().split())
if c <= b and c >= a:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())
a = tuple(map(int,input().split()))

a = sorted(a)

print(a[n//2]-a[n//2-1])
# Judge status: Wrong Answer
N, C, K = map(int, input().split(' '))
bus = []
ans = 0
T = [int(input()) for _ in range(N)]
T.sort()

def init_bus():
    global bus, min_t, ans
    bus = []
    bus.append(t)
    min_t = t
    ans += 1

min_t = 0
for t in T:
    if len(bus) == 0:
        init_bus()
        continue
    if t - min_t < K and len(bus) < C:
        bus.append(t)
# Judge status: Accepted
x, y = map(int, input().split())
ans = -1 if x % y == 0 else x
print(ans)
# Judge status: Wrong Answer
N = int(input())
A_list = list(map(int, input().split()))
 
a_sum = 0
b_sum = 0
for i in range(N//2):
  a,b = (A_list[2*i], A_list[2*i + 1]) if A_list[2*i] > A_list[2*i + 1] else (A_list[2*i + 1], A_list[2*i])
  a_sum += a
  b_sum += b

print(a_sum - b_sum)
# Judge status: Accepted
import math
A, B = map(int, input().split())
K = (A + B)
if K % 2 == 0:
    print(math.floor(K/2))
else :
    print("IMPOSSIBLE")