peterverebics/CodeNet_Python_118 huggingface dataset:
n = int(input())
A = []
B = []
for _ in range(n):
  a, b = map(int, input().split())
  A.append(a)
  B.append(b)

if n%2 == 0:
  Max = (max(A)+max(B))/2
  Min = (min(A)+min(B))/2
  print(int((Max-Min)*2+1))

else:
  A = sorted(A)
  B = sorted(B)
  num = int(n/2)
  A_c = A[num]
  B_c = B[num]
  print(abs(B_c - A_c)+1)
N = int(input())
A = [tuple(map(int, input().split())) for _ in range(N)]
B = A[:]
A.sort(key=lambda x: x[0])
B.sort(key=lambda x: x[1])

if N%2:
    print(B[N//2][1] - A[N//2][0] + 1)
else:
    print((A[N//2][1] + B[N//2-1][1]) - (B[N//2][0] + A[N//2-1][0])+1)
from statistics import median

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

a = [ab[i][0] for i in range(n)]
b = [ab[i][1] for i in range(n)]

if n % 2 == 0:
    ma, mb = median(a), median(b)
    print(int(mb - ma) * 2 + 1)
if n % 2 == 1:
    ma, mb = median(a), median(b)
    print(int(mb - ma + 1))
import statistics
import math

N = int(input())
A = []
B = []
for i in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)
Am = statistics.median(A)
Bm = statistics.median(B)

print(Am)
print(Bm)

if N % 2 == 0:
    print(2 * round(Bm - Am) + 1)
else:
    print(round(Bm - Am) + 1)
n=int(input())
a,b=[0]*n,[0]*n
for i in range(n):
    a[i],b[i]=map(int,input().split())
a.sort()
b.sort()
if n&1:
    print(b[n//2]-a[n//2]+1)
else:
    print(1+(b[(n-1)//2]-a[n//2]+1)*2)
N = int(input())
List = []

A = []
B = []

for i in range(N):
  a,b = map(int,input().split())
  List.append([a,b])
  A.append(a)
  B.append(b)
  

if N%2 == 1:
  A.sort()
  B.sort()
  ans = B[N//2] - A[N//2] + 1
  print(int(ans))
else:
  A.sort()
  B.sort()
  c = B[N//2] - A[N//2] + 1
  d = B[N//2-1] - A[N//2-1] + 1
  print(int(c*d-min(c,d)+1))
from sys import stdin
input = stdin.readline

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

ab.sort()

ran = []

for a, b in ab:
    ran.append(b - a + 1)

ran.sort()

if N % 2 == 0:
    a1, b1 = ab[N // 2 - 1]
    a2, b2 = ab[N // 2]
    xa = (a2 - a1) / 2
    xb = (b2 - b1) / 2
    print((xb - xa) * 2 - 1)
else:
    print(ran[N // 2])
def main():
    n = int(input())
    a, b = [], []
    for _ in range(n):
        A, B = map(int, input().split())
        a.append(A)
        b.append(B)
    from statistics import median
    import math
    i = int(median(a))
    j = int(median(b))
    if n % 2 == 1:
        print(j - i + 1)
    else:
        print((j - i) * 2)
main()
N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]

A = sorted(A, key=lambda x:x[0])
A = sorted(A, key=lambda x:x[1])

if N%2 == 1:
    a, b = A[(N-1)//2]
    print(b-a+1)
else:
    a1, b1 = A[N//2]
    a2, b2 = A[N//2-1]
    print(b1-a1+b2-a2+1)
import statistics
N=int(input())
A=[None]*N
B=[None]*N
for i in range(N):
  A[i],B[i] = map(int,input().split())
mini = statistics.median(A)
maxi = statistics.median(B)
if N % 2 == 1:
  print((maxi - mini)*2 +1)
else:
  print((maxi-mini)*2+1)
n = int(input())
ab = [map(int, input().split()) for _ in range(n)]
a, b = [list(i) for i in zip(*ab)]

ans = 0
if n % 2 == 1:
    ans = b[(n-1)//2] - a[(n-1)//2] + 1
else:
    ans = b[n//2] + b[n//2 - 1] - a[n//2] - a[n//2 - 1] + 1

print(ans)
N = int(input())
A = []
B = []
for i in range(N):
	a, b = map(int, input().split())
	A.append(a)
	B.append(b)

A.sort()
B.sort()

if N % 2 == 1:
	A_median = A[N // 2]
	B_median = B[N // 2]
	print(A_median, B_median)
	print(B_median - A_median + 1)
else:
	A_median2 = A[(N - 1) // 2] + A[N // 2]
	B_median2 = B[(N - 1) // 2] + B[N // 2]
	print(B_median2 - A_median2 + 1)
n=int(input())
AB=[]
C=[]
for _ in range(n):
    a,b = map(int,input().split())
    #AB.append((a,b))
    C.append(a)
    C.append(b)
C.sort()
#AB = sorted(AB,key=lambda x: x[1])
med = n//2

if n%2 != 0:
    p,q=C[2*n-n//2-1],C[n//2]
    print(p-q+1)
else:
    p,q,r,s = C[n//2-1],C[n//2],C[2*n-n//2-1],C[2*n-n//2]
    print(int(((s+r)/2 - (p+q)/2)*2 + 1))
n = int(input())
info = [list(map(int, input().split())) for i in range(n)]

if n % 2 == 1:
    info = sorted(info)
    l = info[n // 2][0]
    info = sorted(info)[::-1]
    r = info[n // 2][1]
    print(r - l + 1)
    
else:
    info = sorted(info)
    l, lmax = info[n // 2 - 1]
    info = sorted(info)[::-1]
    rmin, r = info[n // 2 - 1]
    if rmin <= lmax:
        print(r * 2 - l * 2 - 1)
    else:
        print(r * 2 - l * 2 - (rmin - lmax) - 1)
n = int(input())
ab =[list(map(int,input().split())) for _ in range(n)]

ab.sort()
a = []
b =[]
for x in ab:
  a.append(x[0])
  b.append(x[1])

ca,cb =0,0
if n % 2 == 0:
  ca = (a[n//2-1] + a[n//2])//2
  cb = (b[n//2-1] + b[n//2])//2
  ans = (cb-ca) / 0.5 +1
else:
  ca = a[(n+1)//2-1]
  cb = b[(n+1)//2-1]
  ans = (cb-ca) +1

print(int(ans))
import sys
input = sys.stdin.buffer.readline

n = int(input())
A = [0]*n
B = [0]*n
for i in range(n):
    a, b = map(int, input().split())
    A[i] = a
    B[i] = b

A.sort()
B.sort()
#print(A)
#print(B)

if n%2 == 1:
    ans = B[(n-1)//2]-A[(n-1)//2]+1
else:
    ans = (B[n//2]-A[n//2-1]-1)*2+1
print(ans)
n,*ab = map(int,open(0).read().split())
a = ab[::2]
b = ab[1::2]
a.sort()
b.sort(reverse=True)

if n%2 == 1:
    med_min = a[(n-1)//2]
    med_max = b[(n-1)//2]
    ans = med_max - med_min + 1
else:
    med_min = (a[n//2-1] + a[n//2] ) //2
    med_max = (b[n//2-1] + b[n//2] ) //2
    ans = (med_max - med_min)*2 + 1

print(ans)
import heapq as hp
n = int(input())
if n%2 ==0:
    m = n//2 + 1
else:
    m = (n+1) //2
a,b = [],[]
for i in range(0,n):
    c = list(map(int, input().split()))
    a.append(c[0])
    b.append(c[1])
print(a,b)
la = hp.nlargest(m,a)
lb = hp.nlargest(m,b)
if n%2 == 0:
    c = la[-1] + la[-2] 
    d = lb[-1] + lb[-2] 
    print(d-c+1)
else:
    print(lb[-1]-la[-1]+1)
n=int(input())
a_arr=[]
b_arr=[]

for i in range(n):
    a,b=map(int,input().split())
    a_arr.append(a)
    b_arr.append(b)
if n%2 !=0:
    ans=b_arr[int((n+1)/2)-1] - a_arr[int((n+1)/2)-1] +1
else:
    ans=b_arr[int(n/2)]-a_arr[int(n/2)-1] +1
print(ans)
N = int(input())
X = [list(map(int, input().split())) for _ in range(N)]

lb = sorted(v for v, _ in X)[N // 2 - 1 + N % 2]
ub = sorted(v for _, v in X)[N // 2 - 1 + N % 2]

if N % 2 == 0:
    print((ub - lb) * 2 + 1)
else:
    print(ub - lb + 1)
n = int(input())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i],b[i] = map(int,input().split())
a.sort()
b.sort()
if n % 2 == 1:
    print(b[n//2] - a[n//2] + 1)
else:
    print(b[n//2] - a[(n-1)//2] +1)
n = int(input())
a = []
b = []
for i in range(n):
    at, bt = map(int, input().split())
    a.append(at)
    b.append(bt)
if(n % 2 == 1):
    a.sort()
    b.sort()
    min_med = a[(n-1)//2]
    max_med = b[(n-1)//2]
    result = max_med - min_med + 1
else:
    a.sort()
    b.sort()
    min_med = a[n//2]
    max_med = b[n//2]
    result = (max_med - min_med)*2 + 1
print(result)
import statistics
n = int(input())
a_list = [0 for i in range(n)]
b_list = [0 for i in range(n)]
x_list = [(0,0) for i in range(n)]

for i in range(n):
  a,b = map(int,input().split())
  a_list[i] = a
  b_list[i] = b
  x_list[i] = (a,b)
  
a_sort = sorted(a_list)
b_sort = sorted(b_list)

a_med = statistics.median_low(a_list)
b_med = statistics.median_high(b_list)
print(b_med-a_med+1)
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
work1=[x[0] for x in l]
work2=[x[1] for x in l]
if n%2==1 : 
    mmin=work1[n//2]
    mmax=work2[n//2]
else:
    mmin=work1[n//2]+work1[n//2-1]
    mmax=work2[n//2]+work2[n//2-1]
print(mmax-mmin+1)
N=int(input())
X1=[]
X=[]
print(X1, X)
for i in range(N):
    x,r=map(int, input().split())
    X1.append(x)
    X.append(r)
X.sort()
X1.sort()
 
if N%2==0:
    print(X[N//2]+X[N//2-1]-X1[N//2]-X1[N//2-1]+1)    
else:
    print(X[N//2]-X1[N//2]+1)
n = int(input())
a=[(0,0)]*n
b=0
for i in range(n):
    h,m=list(map(int,input().split()))
    a[i]=(h,m)
a=sorted(a,key=lambda g:g[0],reverse=True)
a=sorted(a,key=lambda g:g[1])
if n%2:
    k=(n-1)//2
    print(a[k][1]-a[k][0]+1)
else:
    k=n//2
    print(a[k][1]+a[k-1][1]-(a[k][0]+a[k-1][0])+1)
# E

N = int(input())

ab = []

for i in range(N):
  ab.append(tuple(map(int,input().split())))

ab.sort()
  
import statistics
import math

am = statistics.median([i[0] for i in ab])
bm = statistics.median([i[1] for i in ab])

print(am,bm)
if am%0.5 != 0:
  print(bm-am+1)
else:
  print(int(bm-am+2))
n = int(input())
X = []
for i in range(n):
    X.append(list(map(int, input().split())))

ans = 0
if n % 2 == 0:
    A = X[n // 2 - 1][1]
    B = X[n // 2][1]
    a = X[n // 2 - 1][1] - X[n // 2 - 1][0] + 1
    b = X[n // 2][1] - X[n // 2][0] + 1
    if B <= A:
        ans += A - B + 1
        b -= ans
    
    ans = a * b - 1
else:
    ans = X[(n + 1) // 2 - 1][1] - X[(n + 1) // 2 - 1][0] + 1
    
print(ans)
n = int(input())
x = [list(map(int,input().split())) for i in range(n)]

if n%2==0:
    min_sum = x[(n//2)-1][0]+x[(n//2)][0]
    max_sum = x[(n//2)-1][1]+x[(n//2)][1]
    print(int((max_sum-min_sum+1)/2//0.5))
else:
    tmp = x[n//2]
    print(len(range(tmp[0], tmp[-1]+1)))
n = int(input())
A = []
B = []
for i in range(n):
  a,b = map(int,input().split())
  A.append(a)
  B.append(b)
A.sort()
B.sort()
if n%2 == 1:
  print(B[(n-1)//2] - A[(n-1)//2] + 1)
else:
  M = ( B[n//2 - 1] + B[n//2] ) / 2
  m = ( A[n//2 - 1] + A[n//2] ) / 2
  ans = int(M) - int(m)+1
  if M > int(M) and M!=m:
    ans +=1
#  print(m,M)
  print(ans)
def main(N, lines):
    a = sorted(map(lambda line: line[0], lines))
    b = sorted(map(lambda line: line[1], lines))

    if N % 2 == 1:
        mi = a[N // 2]
        ma = b[N // 2]
        print(ma - mi + 1)
    else:
        mi = (a[N // 2 - 1] + a[N // 2]) / 2
        ma = (b[N // 2 - 1] + b[N // 2]) / 2
        print(int(ma - mi + 1))


N = int(input())
lines = []
for i in range(N):
    lines.append(list(map(int, input().split())))
main(N, lines)
N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]
right = []
left = []

for a, b in AB:
    right.append(b)
    left.append(a)
right.sort(reverse=True)
left.sort()
if N%2==0:
    n = N//2-1
    print((right[n]-left[n])*2-1)
else:
    n = N//2
    print(right[n]-left[n]+1)
n=int(input())
ab,ba=[],[]
for i in range(n):
    a,b=map(int,input().split())
    ab.append([a,b])
    ba.append([b,a])
ab.sort()
ba.sort(reverse=True)
ans=0
if n%2==1:
    s=ab[n//2][0]
    g=ba[n//2][0]
    ans=g-s+1
else:
    s=ab[n//2-1][0]
    g=ba[n//2-1][0]
    ans=(g-s+1)*(g-s)//2
print(ans)
N = int(input())
AB = [map(int, input().split()) for _ in range(N)]
A,B = [list(i) for i in zip(*AB)]
A.sort()
B.sort()
e = int(N/2-1)
f = int(N/2)
g = int((N+1)/2-1)
if N%2 == 0:
  C = (A[e]+A[f])/2
  D = (B[e]+B[f])/2
  print(int(D)-int(C))
else:
  C = A[g]
  D = B[g]
  print(int(D)-int(C))
n = int(input())
prob = []
for _ in range(n):
    l = list(map(int,input().split()))
    prob.append(l)
if n%2==1:
    d = (n+1)//2
    print(prob[d-1][1]-prob[d-1][0]+1)
else:
    d1 = n//2
    d2 = (n//2) + 1
    diff1 = (prob[d1-1][1]-prob[d1-1][0]+1)
    diff2 = (prob[d2-1][1]-prob[d2-1][0]+1)
    print(diff1+diff2-1)
n=int(input())
a=[]
b=[]
for i in range(n):
    ai,bi=map(int,input().split())
    a.append(ai)
    b.append(bi)
    
if n%2==0:
    n2=n//2
    ca=(a[n2-1]+a[n2])
    cb=(b[n2-1]+b[n2])
    c=cb-ca+1
else:
    n2=(n-1)//2
    ca=a[n2]
    cb=b[n2]
    c=cb-ca+1
    
print(c)
N = int(input())
A = dict()
B = dict()
for i in range(N):
    a, b = map(int, input().split())
    A[i] = a
    B[i] = b
A_sort = sorted(A.items(), key=lambda x:x[1])
B_sort = sorted(B.items(), key=lambda x:x[1])

if N % 2 == 1:
    print(B_sort[(N+1)//2-1][1]-A_sort[(N+1)//2-1][1]+1)
else:
    B_min = B_sort[N//2-1][1]
    A_min = A_sort[N//2-1][1]
    A_max = A_sort[N//2][1]
    B_max = B_sort[N//2][1]
    print(A_max+B_max-A_min-B_min+1)
n = int(input())
la, lb = [], []
for _ in range(n):
    a, b = map(int, input().split())
    la.append(a)
    lb.append(b)

la.sort()
lb.sort(reverse=True)

if n % 2 == 1:
    i = n // 2 + 1
    md = la[i - 1]
    mu = lb[i - 1]
    answer = mu - md + 1
else:
    i = n // 2
    md = la[i - 1]
    mu = lb[i - 1]
    answer = 2 * (mu - md) - 1

print(answer)
import statistics
n = int(input())

a = [0 for _ in range(n)]
b = [0 for _ in range(n)]
ans = 0

for i in range(n):
    a[i],b[i] = map(int,input().split())

ma = statistics.median(a)
mb = statistics.median(b)

if(n%2 == 1):
    ans = int(mb-ma) + 1
else:
    ans = 2*int(mb-ma) + 1

print(ans)
N = int(input())
A = []
B = []
for i in range(N):
    a,b = input().split()
    A.append(int(a))
    B.append(int(b))
A.sort()
B.sort(reverse = True)
minnum = A[0]
maxnum = B[0] 
if N%2!=0:
  ans = maxnum - minnum +1
else:
  ans = 2*(maxnum - minnum) -1
print(ans)
n=int(input())
a_ls,b_ls=[],[]
for i in range(n):
    a,b=map(int,input().split())
    a_ls.append(a)
    b_ls.append(b)

if n%2==0:
    idx_1,idx_2=(n-2)//2, (n-2)//2 + 1
    print(abs(a_ls[idx_1]+a_ls[idx_2]-b_ls[idx_1]-b_ls[idx_2])+1)
else:
    idx=(n-1)//2
    print(abs(a_ls[idx]-b_ls[idx])+1)
import sys
sys.setrecursionlimit(10**9)

def main():
    N = int(input())
    rg = []

    for i in range(N):
        a,b = map(int,input().split())
        rg.append((a,b))

    rg.sort()
    if N % 2 == 1:
        a,b = rg[(N+1)//2-1]
        print(b-a+1)
        exit()

    a,b = rg[N//2-1]
    c,d  =rg[N//2]

    print(b+d-a-c+1)




if __name__ == "__main__":
  main()
n=int(input())
if n%2==1:
    for i in range(n):
        sr=input()
        if i==n//2:
            a,b=map(int,sr.split( ))
    print(b-a+1)
else:
    for i in range(n):
        sr=input()
        if i==n/2-1:
            a,b=map(int,sr.split( ))
        if i==n/2:
            c,d=map(int,sr.split( ))
    print(b+d-c-a+1)
n=int(input())
a=[0]*n
b=[0]*n
for i in range(n):
  a[i],b[i]=map(int,input().split())
a.sort()
b.sort()
if n%2:ans=b[n//2]-a[n//2]+1
else:ans=b[(n-1)//2+1]-a[(n-1)//2]+1
print(ans)
# E

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

sorted_by_A = sorted(ABs, key=lambda ab: ab[0])
sorted_by_B = sorted(ABs, key=lambda ab: ab[1])

if N % 2 == 1:
    d = (N - 1) // 2
    A = sorted_by_A[d][0]
    B = sorted_by_B[d][1]
    print(B - A + 1)
else:
    d = (N - 1) // 2
    left = sorted_by_A[d]
    right = sorted_by_B[d]
    print((right[1] - right[0] + 1) + (left[1] - left[0] + 1) - 1)
N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]
AX = [A[i][0] for i in range(N)]
BX = [A[i][1] for i in range(N)]
AX.sort()
BX.sort()
if N % 2 == 1:
  L = AX[(N-1)//2]
  R = BX[(N-1)//2]
  print(R-L+1)
else:
  L = AX[N//2] + AX[N//2]
  R = BX[N//2] + BX[N//2]
  print(R-L+1)
N = int(input())
A = []
B = []
for _ in range(N):
  a,b = [int(i) for i in input().split()]
  A.append(a)
  B.append(b)
A.reverse()
B.reverse()
if N%2 == 1:
  M = ((N+1)//2)-1
  print(B[M]-A[M]+1)
  exit()
M = (N//2)-1
L = (N//2)
print(B[M]+B[L]-A[M]-A[L]+1)
import statistics

n = int(input())
left = []
right = []
for _ in range(n):
    a, b = map(int, input().split())
    left.append(a)
    right.append(b)

if n%2 == 0:
    leftId = statistics.median_high(left) - statistics.median_low(left)
    rightId = statistics.median_high(right) - statistics.median_low(right)
    print(int((rightId - leftId)*2 + 1))
else:
    leftId = statistics.median(left)
    rightId = statistics.median(right)
    while True:
        x = 1
    print(rightId - leftId + 1 - aaa)
N = int(input())
A = []
B = []
for n in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
#AB = sorted(AB, key=lambda x: x[0])
#print(AB)
A.sort()
B.sort()

if N % 2 == 1:
    print(int(B[N//2] - A[N//2] + 1))

elif N % 2 == 0:
    print(int((B[N//2] - A[N//2])*2 + 1))
    
else:
    print('RE')
import bisect
n = int(input())
a = []
b = []

for i in range(n):
    m, p = map(int, input().split())
    a.append(m)
    b.append(p)
a.sort()
b.sort()
middle = n // 2
if n % 2:
    print(b[middle] - a[middle] + 1)
else: 
    a_m = ( a[middle] + a[middle - 1] ) / 2
    b_m = ( b[middle] + b[middle - 1] ) / 2
    print((b_m - a_m) * 2 + 1)
import statistics
import math

N = int(input())
A = []
B = []
for i in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)
Am = statistics.median(A)
Bm = statistics.median(B)

if N % 2 == 0:
    print(2 * round(Bm - Am) + 1)
else:
    print(round(Bm - Am) + 1)
import bisect

n = int(input())

l = []
r = []

for i in range(n):
    a, b = map(int, input().split())
    l.append(a)
    r.append(b)

l.sort()
r.sort(reverse=True)

if n%2 == 1:
    print(r[(n-1)//2]-l[(n-1)//2]+1)
else:
    print(2*(r[(n-2)//2]-l[(n-2)//2])-1)
n = int(input())
ab = [list(map(int, input().split())) for _i in range(n)]
x, y = [], []
for i, j in ab:
    x.append(i)
    y.append(j)
x.sort()
y.sort(reverse=True)
if n%2==1:
    p = (n+1)//2 -1
    print(y[p]-x[p]+1)
else:
    p = n//2
    print(y[p-1]-x[p-1]+1)
N = int(input())
left = []
right = []
for _ in range(N):
    A, B = list(map(int, input().split()))
    left.append(A)
    right.append(B)
left.sort()
right.sort(reverse=True)
n = (N+1)//2-1
print(right[n]-left[n]+1)
N = int(input())
A = []
B = []
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
A.sort()
B.sort()
a = (A[(N-1)//2] + A[N//2]+1)//2
b = (B[(N-1)//2] + B[N//2])//2
print(b-a+1)
n=int(input())
ans=0
for i in range(n):
    a,b=map(int,input().split())
    if(n%2==0 and i==n//2-1):
        ans=b-a+2
    if(n%2!=0 and i==n//2):
        ans=b-a+1
print(ans)
N = int(input())
L = list()
As, Bs= list(),list()
for i in range(N):
    A,B = map(int,input().split())
    L.append([A,B])
    As.append(A)
    Bs.append(B)

As.sort()
Bs.sort()
if N % 2 == 0:
    mins = (As[N//2] + As[N//2-1]) / 2.0
    maxs = (Bs[N//2] + Bs[N//2-1]) / 2.0
else:
    mins,maxs = As[N//2], Bs[N//2]

print(int(maxs-mins)+1)
n = int(input())
min = []
max = []
for i in range(n):
  a, b = map(int, input().split())
  min.append(a)
  max.append(b)

if n%2 == 0:
  print((max[n//2] + max[n//2 - 1]) -(min[n//2] + min[n//2 - 1])+ 1)
else:
  print(max[n//2]-min[n//2]+1)
def main():
    n = int(input())
    AB = [list(map(int, input().split())) for _ in range(n)]
    if n % 2 == 1:
        m = (n + 1) // 2
        a, b = AB[m-1]
        print(b - a + 1)
    else:
        a, b = AB[n//2-1]
        c, d = AB[n//2 ]
        print(b-a+d-c+1)
main()
n = int(input())
min = []
max = []
for i in range(n):
  a, b = map(int, input().split())
  min.append(a)
  max.append(b)
min.sort()
max.sort()
if n%2 == 0:
  print((max[n//2] + max[n//2 - 1]) -(min[n//2] + min[n//2 - 1])+ 1)
else:
  print(max[n//2]-min[n//2]+1)
print(min)
import math


def median(array):
    if N % 2:
        return array[N // 2]
    else:
        return sum(array[N // 2 - 1: N // 2 + 1]) / 2


N = int(input())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
x = median(A)
y = median(B)
if N % 2:
    print(y - x + 1)
else:
    temp = math.floor(y) - math.floor(x)
    print(2 * temp + 1)
from sys import stdin
input = stdin.readline
N = int(input())
A = [0]*N
B = [0]*N
for i in range(N):
    a, b = map(int, input().split())
    A[i] = a
    B[i] = b
A.sort()
B.sort()
if N%2 == 0:
    temp = N//2
    m = (A[temp]+A[temp-1])/2
    M = (B[temp]+B[temp-1])/2
    print(int(M-m+1)*2-1)
else:
    temp = N//2
    print(B[temp]-A[temp]+1)
n = int(input())
lister = []
for i in range(n):
    lister.append([int(i) for i in input().split()])
 
if n % 2 == 1:
    lister.sort(key=lambda x:x[0])
    miner = lister[n//2][0]
    lister.sort(key=lambda x:x[1])
    maxer = lister[n//2][1]
    print(maxer- miner + 1)
else:
    lister.sort(key=lambda x:x[0])
    miner = lister[n//2 - 1][0]
    lister.sort(key=lambda x:x[1])
    maxer = lister[n//2][1]
    print(1 + (maxer- miner) ** 2)
from sys import stdin
from decimal import Decimal
N = int(stdin.readline().rstrip())
A = []
B = []
for i in range(N):
    a,b = [int(x) for x in stdin.readline().rstrip().split()]
    A.append(a)
    B.append(b)
    
A.sort()
B.sort()
amin = min(A)
amax = max(A)
bmin = min(B)
bmax = max(B)

if N % 2 == 0:
    ans = 2 * (bmin-amin) + 2 * (bmax-amax)
    print(ans//2+1)
else:
    ans = B[N//2] - A[N//2] + 1
    print(ans)
N = int(input())
ABs = list(tuple(map(int, input().split())) for _ in range(N))
ABs_sortby_A = sorted(ABs, key=lambda x: x[0])

a, b = ABs_sortby_A[N // 2]

print(b - a + 1)
n = int( input())
A = []
B = []

for i in range( n ):
  a, b = map( int, input().split() )
  A.append( a )
  B.append( b )

A = sorted( A )
B = sorted( B )

if n % 2 == 0:
  i1 = n // 2 - 1
  i2 = n // 2
  print( ( B[ i2 ] - A[ i2 ] + 1 ) * ( B[ i1 ] - A[ i1 ] + 1 ) - 1 )
else:
  i = ( n + 1 ) // 2 - 1
  print( B[ i ] - A[ i ] + 1 )
n = int(input())
bounds = [list(map(int, input().split())) for _ in range(n)]
upper = [b[1] for b in bounds]
lower = [b[0] for b in bounds]

if n % 2 == 0:
	u_mid2 = upper[n // 2 - 1] + upper[n // 2]
	l_mid2 = lower[n // 2 - 1] + lower[n // 2]
	print(u_mid2 - l_mid2 + 1)
else:
	print(upper[n // 2] - lower[n // 2] + 1)
n = int(input())
A = []
B = []
for i in range(n):
  a,b = map(int,input().split())
  A.append(a)
  B.append(b)
A.sort()
B.sort()
if n%2 == 1:
  print(B[(n-1)//2] - A[(n-1)//2] + 1)
else:
  M = ( B[n//2 - 1] + B[n//2] ) / 2
  m = ( A[n//2 - 1] + A[n//2] ) / 2
  ans = int(M) - int(m)+1
  if M > int(M):
    ans +=1
  print(ans)
import math


def median(array):
    if N % 2:
        return array[N // 2]
    else:
        return sum(array[N // 2 - 1: N // 2]) // 2


N = int(input())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
x = median(A)
y = median(B)
if N % 2:
    print(y - x + 1)
else:
    print(y - x + 2)
n = int(input())
a_list = []
b_list = []

for _ in range(n):
    a, b = map(int,input().split())
    a_list.append(a)
    b_list.append(b)
a_list.sort()
b_list.sort()

if n%2==0:
    half = int(n/2)
    first = (a_list[half]+a_list[half])/2
    last = (b_list[half]+b_list[half])/2
    print(int((last-first)/0.5)+1)
else:
    half = int((n+1)/2)
    print(b_list[half-1]-a_list[half-1]+1)
N = int(input())
ab = [list(map(int, input().split())) for _ in range(N)]


if N % 2 == 0:
    print(1)
else:
    print(ab[N // 2][1] - ab[N // 2][0] + 1)
n = int(input())
a = []
b = []
for i in range(n):
   ai,bi = [int(j) for j in input().split()]
   a.append(ai)
   b.append(bi)
a.sort()
b.sort()
if n % 2 == 1:
   tg = (n+1) // 2
   ans = b[-tg] + a[tg-1] + 1
else:
   tg = n//2
   ans = b[-tg] + b[-tg-1] - a[tg-1] - a[tg] +1
print(ans)
n = int(input())
x = [list(map(int,input().split())) for i in range(n)]

if n%2==0:
    min_sum = x[(n//2)-1][0]+x[(n//2)][0]
    max_sum = x[(n//2)-1][1]+x[(n//2)][1]
    print(int((max_sum-min_sum)+1/2//0.5))
else:
    tmp = x[n//2]
    print(len(range(tmp[0], tmp[-1]+1)))
N = int(input())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

A.sort()
B.sort()

if N % 2 == 1:
    ans = B[N//2] - A[N//2]+1
    print(ans)
else:
    vmin = A[N//2-1]+B[N//2-1]
    vmax = A[N//2]+B[N//2]
    ans = vmax-vmin+1
    print(ans)
from statistics import median

N = int(input())
A = [0] * N
B = [0] * N
max=0
min =0
for c in range(N):
    A[c], B[c] = map(int, input().split())

med_A = median(A)
med_B = median(B)

if N%2==0:
    print((med_B-med_A)*2+1)
else:
    print(med_B-med_A+1)
n=int(input())
import statistics
import math
a=[]
b=[]
for i in range(n):
    a1,b1=map(int,input().split())
    a.append(a1)
    b.append(b1)
a.sort()
b.sort()
if n%2==0:
    am=statistics.mean(a)
    bm=statistics.mean(b)
    print(math.floor((bm-am)*2)+1)
else:
    aM=statistics.median(a)
    bM=statistics.median(b)
    print(bM-aM+1)
n = int(input())

a = []
b = []
for i in range(n):
    ai, bi = map(int,input().split())
    a.append(ai)
    b.append(bi)

p = []
for i in range(n):
    p.append(b[i] - a[i] + 1)
    #print(b[i] - a[i] + 1)

p.sort()
if n % 2 == 0:
    print(p[n//2] + 1)
else:
    print(p[n//2])
from statistics import median

n = int(input())

a = []
b = []

for _ in range(n):
    x, y = map(int, input().split())
    a.append(x)
    b.append(y)

print(median(b) - median(a) + 1)