qyliang/CodeNanoFix huggingface dataset:
# Buggy code:
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()

print(A, B)
if N % 2 == 0:
    n1 = N // 2 - 1
    n2 = N // 2
    ans = B[n1] - A[n1] + B[n2] - A[n2] + 1
    print(ans)

else:
    n = N // 2
    ans = B[n] - A[n] + 1
    print(ans)

# Fixed code:
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 == 0:
    n1 = N // 2 - 1
    n2 = N // 2
    ans = B[n1] - A[n1] + B[n2] - A[n2] + 1
    print(ans)

else:
    n = N // 2
    ans = B[n] - A[n] + 1
    print(ans)
# Buggy code:
N = int(input())
A = []
B = []
for i in range(N):
  a,b = map(input().split())
  A.append(a)
  B.append(b)

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

# Fixed code:
N=int(input())
a=[]
b=[]
for _ in range(N):
    A,B=map(int,input().split())
    a.append(A)
    b.append(B)
a=sorted(a)
b=sorted(b)
if N%2==1:
    print(b[N//2]-a[N//2]+1)
else:
    print(int(((b[N//2-1]+b[N//2])/2-(a[N//2-1]+a[N//2])/2)*2+1))
# Buggy code:
n = int(input())
la = []
lb = []
for i in range(n):
  a, b = map(int, input().split())
  la.append(a)
  lb.append(b)
a = statistics.median(la)
b = statistics.median(lb)
if n % 2 == 1:
  print(b - a + 1)
else:
  print((b - a) * 2 - 1)

# Fixed code:
import statistics

n = int(input())
la = []
lb = []
for i in range(n):
  a, b = map(int, input().split())
  la.append(a)
  lb.append(b)
a = statistics.median(la)
b = statistics.median(lb)
if n % 2 == 1:
  print(b - a + 1)
else:
  print(int((b - a) * 2 + 1))
# Buggy code:
n = int(input())
AB = [tuple(map(int, input().split())) for i in range(n)]
A = [AB[i][0] for i in range(n)]
B = [AB[i][1] for i in range(n)]
# A = [(AB[i][0], i) for i in range(n)]
# B = [(AB[i][1], i) for i in range(n)]

A.sort()
B.sort()

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

print(A, B)

if n % 2 == 0:
    # x = abs(A[n // 2 - 1] + B[n // 2])
    # y = abs(A[n // 2] + B[n // 2 - 1])
    # print(x, y)
    # print(abs(x - y) + 1)

    # print(x, y)
    a = A[n // 2] + A[n // 2 - 1]
    b = B[n // 2] + B[n // 2 - 1]
    print(b-a+1)
    # print(a, b)
    # print(B[n // 2] - A[n // 2 - 1] + 1)


# Fixed code:
n = int(input())
AB = [tuple(map(int, input().split())) for i in range(n)]
A = [AB[i][0] for i in range(n)]
B = [AB[i][1] for i in range(n)]
# A = [(AB[i][0], i) for i in range(n)]
# B = [(AB[i][1], i) for i in range(n)]

A.sort()
B.sort()

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


if n % 2 == 0:
    # x = abs(A[n // 2 - 1] + B[n // 2])
    # y = abs(A[n // 2] + B[n // 2 - 1])
    # print(x, y)
    # print(abs(x - y) + 1)

    # print(x, y)
    a = A[n // 2] + A[n // 2 - 1]
    b = B[n // 2] + B[n // 2 - 1]
    print(b - a + 1)
    # print(a, b)
    # print(B[n // 2] - A[n // 2 - 1] + 1)
# Buggy code:
n=int(input())
import bisect as bi
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=A[(n-1)//2] ; b=B[(n-1)//2]
    print(a,b)
    print(b-a+1)
else:
    a=(A[n//2-1]+A[n//2])/2 ; b=(B[n//2-1]+B[n//2])/2
    print(a,b)
    print(int((b-a)/0.5)+1)

# Fixed code:
n=int(input())
import bisect as bi
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=A[(n-1)//2] ; b=B[(n-1)//2]
  
    print(b-a+1)
else:
    a=(A[n//2-1]+A[n//2])/2 ; b=(B[n//2-1]+B[n//2])/2
  
    print(int((b-a)/0.5)+1)
# Buggy code:
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//2][1]-A[N//2][0]+1)
else:
    r = (B[N//2-1][1]+B[N//2][1])
    l = (A[N//2-1][0]+A[N//2][0])
    print(r-l+1)

# Fixed code:
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()
ans=0
if(N%2==1):
  print(B[N//2]-A[N//2]+1)
else:
  ans+=(B[N//2]+B[N//2-1])-(A[N//2]+A[N//2-1])+1
  print(ans)
# Buggy code:
def main():
    import sys
    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:
        ma = (A[n//2]+A[n//2-1])/2
        mb = (B[n//2]+B[n//2-1])/2
        ans = 2*(mb-ma) - 1
        print(ans)
    else:
        ma = A[n//2]
        mb = B[n//2]
        ans = int((mb-ma) +1)
        print(ans)
        
        
if __name__ == '__main__':
    main()

# Fixed code:
def main():
    import sys
    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:
        ma = (A[n//2]+A[n//2-1])/2
        mb = (B[n//2]+B[n//2-1])/2
        ans = int(2*(mb-ma) + 1)
        print(ans)
    else:
        ma = A[n//2]
        mb = B[n//2]
        ans = (mb-ma) + 1
        print(ans)
        
        
if __name__ == '__main__':
    main()
# Buggy code:
# 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))


# Fixed code:
# 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])

if N%2 != 0:
  print(bm-am+1)
else:
  print(int((bm-am)*2+1))
# Buggy code:
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)

# Fixed code:
import statistics

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(round(2 * (Bm - Am) + 1))
else:
    print(Bm - Am + 1)
# Buggy code:
n = int(input())

ls = []
rs = []
for _ in range(n):
    x, y = map(int, input().split())
    ls.append(x)
    rs.append(y)

if n % 2 == 1:
    print(rs[len(rs)//2] - ls[len(ls)//2] + 1)
else:
    a = (rs[len(rs)//2-1] * 10 + rs[len(rs)//2] * 10) / 2
    b = (ls[len(ls)//2-1] * 10 + ls[len(ls)//2] * 10) / 2
    print((a - b) // 5 + 1)

# Fixed code:
n = int(input())

ls = []
rs = []
for _ in range(n):
    x, y = map(int, input().split())
    ls.append(x)
    rs.append(y)

ls = sorted(ls)
rs = sorted(rs)

if n % 2 == 1:
    print(rs[len(rs)//2] - ls[len(ls)//2] + 1)
else:
    a = (rs[len(rs)//2-1] * 10 + rs[len(rs)//2] * 10) // 2
    b = (ls[len(ls)//2-1] * 10 + ls[len(ls)//2] * 10) // 2
    print((a - b) // 5 + 1)
# Buggy code:
N = int(input())
listA = [0] * N
listB = [0] * N
idx = 0
for i in range(N):
  listA[idx],listB[idx] = map(int, input().split())
  idx += 1

medianA = 0
medianB = 0
ans = 0
if N%2 == 0:
  medianA = statistics.median(listA)
  medianB = statistics.median(listB)
  ans = (medianB - medianA) * 2 + 1
else:
  medianA = statistics.median(listA)
  medianB = statistics.median(listB)
  ans = medianB - medianA + 1

print(int(ans))

# Fixed code:
import statistics
import math

N = int(input())
listA = [0] * N
listB = [0] * N
idx = 0
for i in range(N):
  listA[idx],listB[idx] = map(int, input().split())
  idx += 1

medianA = 0
medianB = 0
ans = 0
if N%2 == 0:
  medianA = statistics.median(listA)
  medianB = statistics.median(listB)
  ans = (medianB - medianA) * 2 + 1
else:
  medianA = statistics.median(listA)
  medianB = statistics.median(listB)
  ans = medianB - medianA + 1

print(int(ans))
# Buggy code:
N = int(input())
left = []
right = []
for _ in range(N):
    l, r = map(int, input().split())
    left.append(l)
    right.append(r)
left.sort()
right.sort()
if N%2==0:
    for i, (l, r) in enumerate(zip(left, right[1:]), 1):
        if i==N//2:
            print((r-l)*2-1)
else:
    for i, (l, r) in enumerate(zip(left, right[1:]), 1):
        if i==N//2:
            print(r-l+1)   

# Fixed code:
N = int(input())
left = []
right = []
for _ in range(N):
    l, r = map(int, input().split())
    left.append(l)
    right.append(r)
left.sort()
right.sort()
if N%2==0:
    for i, (l, r) in enumerate(zip(left, right), 1):
        if i==N//2:
            L = l
            R = r
        if i==N//2+1:
            R +=r
            L += l
            print((R-L)+1)
else:
    for i, (l, r) in enumerate(zip(left, right), 1):
        if i==N//2+1:
            print(r-l+1)
# Buggy code:
N = int(input())
ab = []
for i in range(N):
    ab.append(tuple(map(int,input().split())))
 
up = sorted(ab,key=lambda a:a[0],reverse=True)
down = sorted(ab,key=lambda a:a[1],reverse=True)
 
if N%2 == 1:
    print(up[N//2][1]-down[N//2][0]+1)
else:
  up2 = sorted(ab,key=lambda a:a[0],reverse=True)
  down2 = sorted(ab,key=lambda a:a[1],reverse=True)
    r = (up[N//2][1]+up2[N//2][1])
    l = (down[N//2][0]+down2[N//2][0])
    print(r-l+1)

# Fixed code:
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)
# Buggy code:
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(ma,mb)
    print(int(mb - ma) * 2 + 1)
if n % 2 == 1:
    ma, mb = median(a), median(b)
    print(int(mb - ma + 1))




# Fixed code:
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(2 * mb - 2 * ma + 1))
if n % 2 == 1:
    ma, mb = median(a), median(b)
    print(int(mb - ma + 1))
# Buggy code:
#!/usr/bin/env python3
import statistics.median()

n = int(input())

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

a_median = statistics.median(a)
b_median = statistics.median(b)

if n % 2 == 0:
    print(b_median-a_median+1)
else:
    print(b_median*2-a_median*2+1)



# Fixed code:
#!/usr/bin/env python3
import statistics

n = int(input())

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

a_median = statistics.median(a_list)
b_median = statistics.median(b_list)

# print(a_median)
# print(b_median)
if n % 2 != 0:
    print(int(b_median-a_median+1))
else:
    print(int(b_median*2-a_median*2+1))
# Buggy code:
N = int(input())
A = [None]*N
B = [None]*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:
    x=A[N//2-1]
    y=B[N//2]
    else:
      x=A[N//2]
      y=B[N//2]
      print(y-x+1)


# Fixed code:
N = int(input())
A = [None] * N
B = [None] * 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:
    b = (B[N // 2] + B[(N - 1) // 2]) / 2
    a = (A[N // 2] + A[(N - 1) // 2]) / 2
    print(int((b - a) * 2 + 1))
else:
    print(B[N // 2] - A[N // 2] + 1)
# Buggy code:
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 != 0):    
    print(B[N//2+1]-A[N//2+1]+1)
else:
    print(B[N//2]+B[N//2-1] - A[N//2]-A[N//2-1] + 1)

# Fixed code:
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 == 0:
    b = (B[N//2-1]+B[N//2])/2
    a = (A[N//2-1]+A[N//2])/2
    ans = (b-a)//0.5 +1
else:
    b = B[(N+1)//2-1]
    a = A[(N+1)//2-1]
    ans = b-a+1
print(int(ans))
# Buggy code:
from math import *
from statistics import median
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:
    ans=median(B)-median(A)+1
else:
    ans=(median(B)-median(A))*2+1
print(ans)

# Fixed code:
from math import *
from statistics import median
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:
    ans=B[(N+1)//2-1]-A[(N+1)//2-1]+1
else:
    ans=1+((B[N//2-1]+B[N//2]))-((A[N//2-1]+A[N//2]))
print(ans)
# Buggy code:
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)

# Fixed code:
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 == 1:
   ans = b[0] - a[0] + 1
elif 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)
# Buggy code:
N = int(input())
A_list = [0]*N
B_list = [0]*N
for i in range(N):
    A_list[i],B_list[i] = map(int,input().split())

A_list.sort()
B_list.sort()

if N%2 == 1:
    print(B_list[(N+1)//2] - A_list[(N+1)//2] + 1)
else:
    big = (B_list[N//2] + B_list[N//2-1])/2
    small = (A_list[N//2] + A_list[N//2-1])/2
    print(int((big-small)*2 + 1))

# Fixed code:
N = int(input())
A_list = [0]*N
B_list = [0]*N
for i in range(N):
    A_list[i],B_list[i] = map(int,input().split())

A_list.sort()
B_list.sort()

if N%2 == 1:
    print(B_list[(N-1)//2] - A_list[(N-1)//2] + 1)
else:
    big = (B_list[N//2] + B_list[N//2-1])/2
    small = (A_list[N//2] + A_list[N//2-1])/2
    print(int((big-small)*2 + 1))
# Buggy code:
n=int(input())
alis=[]
blis=[]
for i in range(n):
  a,b=map(int,input().split())
  alis.ppend(a)
  blis.append(b)
  
  
alis=sorted(alis)
blis=sorted(blis)
if n%2!=0:
  print(blis[int((n-1)/2)]-alis[int((n-1)/2)+1]
else:
  bb=(blis[int(n/2)-1]+blis[int(n/2)])
  aa=(alis[int(n/2)-1]+alis[int(n/2)])
  print(bb-aa+1)

# Fixed code:
n=int(input())
alis=[]
blis=[]
for i in range(n):
  a,b=map(int,input().split())
  alis.append(a)
  blis.append(b)
  
  
alis=sorted(alis)
blis=sorted(blis)
if n%2!=0:
  print(blis[int((n-1)/2)]-alis[int((n-1)/2)]+1)
else:
  bb=(blis[int(n/2)-1]+blis[int(n/2)])
  aa=(alis[int(n/2)-1]+alis[int(n/2)])
  print(bb-aa+1)
# Buggy code:
n=int(input())
aa=[]
bb=[]
for i in range(n):
    a,b=map(int,input().split())
    aa.append(a)
    bb.append(b)
aa.sort()
bb.sort()
if(n%2==0):
    print(b[n//2-1]+b[n//2]-a[n//2]-a[n//2-1]+1)
else:
    print(b[n//2]-a[n//2]+1)

# Fixed code:
n=int(input())
aa=[]
bb=[]
for i in range(n):
    a,b=map(int,input().split())
    aa.append(a)
    bb.append(b)
aa.sort()
bb.sort()
if(n%2==0):
    print(bb[n//2-1]+bb[n//2]-aa[n//2]-aa[n//2-1]+1)
else:
    print(bb[n//2]-aa[n//2]+1)
# Buggy code:
N = int(input())
A = list()
B = list()
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):
  x = A[(N-1)//2]
  y = B[(N-1)//2]
  print(y-x+1)
else:
  x = A[(N//2)+1] + A[N//2]
  y = B[(N//2)+1] + B[N//2]
  print(y-x+1)

# Fixed code:
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:
    x = A[n//2]
    y = B[n//2]
else:
    x = A[n//2 - 1]+A[n//2]
    y = B[n//2 - 1]+B[n//2]
print(y-x+1)
# Buggy code:
n = int(input())
minnums = [[] for _ in range(n)]
maxnums = [[] for _ in range(n)]

for i in range(n):
  minnums[i], maxnums[i] = map(int, input().split())
  
minnums.sort()
maxnums.sort()

if n % 2:
  minmedian = minnums[n // 2]
  maxmedian = maxnums[n // 2]
  print(maxmedian - minmedian + 1)
else:
  minmedian = (minnums[n // 2 - 1] + minnums[n // 2]) / 2
  maxmedian = (maxnums[n // 2 - 1] + maxnums[n // 2]) / 2
  print(int((maxmedian - minmedian) * 2 + 1))


print(minmedian, maxmedian)

# Fixed code:
n = int(input())
minnums = [[] for _ in range(n)]
maxnums = [[] for _ in range(n)]

for i in range(n):
  minnums[i], maxnums[i] = map(int, input().split())
  
minnums.sort()
maxnums.sort()

if n % 2:
  minmedian = minnums[n // 2]
  maxmedian = maxnums[n // 2]
  print(maxmedian - minmedian + 1)
else:
  minmedian = (minnums[n // 2 - 1] + minnums[n // 2]) / 2
  maxmedian = (maxnums[n // 2 - 1] + maxnums[n // 2]) / 2
  print(int((maxmedian - minmedian) * 2 + 1))
# Buggy code:
n = int(input())
ab =[list(map(int,input().split())) for _ in range(n)]

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

a.sort()
b.sort()
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)//0.5 +1

print(int(ans))

# Fixed code:
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])
a.sort()
b.sort()

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 = int((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))
# Buggy code:
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)


# Fixed code:
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
    print(int((maxs-mins)/0.5)+1)
else:
    mins,maxs = As[N//2], Bs[N//2]

    print(int(maxs-mins)+1)
# Buggy code:
import math

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()

mid_a = A[(N + 1) // 2 - 1] if N % 2 == 1 else (A[N // 2 - 1] + A[N // 2]) / 2
mid_b = B[(N + 1) // 2 - 1] if N % 2 == 1 else (B[N // 2 - 1] + B[N // 2]) / 2

ans = 0
if isinstance(mid_a, float):
    if not mid_a.is_integer():
        ans += 1
        mid_a = math.ceil(mid_a)
if isinstance(mid_b, float):
    if not mid_b.is_integer():
        ans += 1
        mid_b = math.floor(mid_b)
print(mid_b - mid_a + 1)


# Fixed code:
import math

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()

mid_a = A[(N + 1) // 2 - 1] if N % 2 == 1 else (A[N // 2 - 1] + A[N // 2]) / 2
mid_b = B[(N + 1) // 2 - 1] if N % 2 == 1 else (B[N // 2 - 1] + B[N // 2]) / 2

# ans = 0
# if isinstance(mid_a, float):
#     if not mid_a.is_integer():
#         ans += 1
#         mid_a = math.ceil(mid_a)
# if isinstance(mid_b, float):
#     if not mid_b.is_integer():
#         ans += 1
#         mid_b = math.floor(mid_b)

ans = (mid_b - mid_a + 1) if N % 2 == 1 else int((mid_b - mid_a) * 2) + 1
print(ans)
# Buggy code:
import collections
n=int(input())
A=[]
AA=[]
B=[]
C=[]
X=[]
mod=10**9+7
for i in range(n):
  a,b=map(int,input().split())
  if a<0:
    a=a*-1
    b=b*-1
  if a*b>0:
    A.append(b*pow(a,mod-2,mod)%mod)
  elif a*b<0:
    AA.append(a*pow((-b),mod-2,mod)%mod)
  else:
    if a==0 and b==0:
      X.append(i)
    elif a==0:
      B.append(i)
    else:
      C.append(i)
D=collections.Counter(A)
DD=collections.Counter(AA)
E=set(list(D)+list(DD))
a=1
for i in E:
  a=(a*(2**D[i]+2**DD[i]-1))%mod
if len(B)==0 and len(C)==0:
  pass
elif len(B)==0:
  a=(a*(2**len(C))-1)%mod
elif len(C)==0:
  a=(a*(2**len(B))-1)%mod
else:
  a=(a*(2**len(B)+2**len(C)-1)-1)%mod
print((a+len(X))%mod)

# Fixed code:
import collections
n=int(input())
A=[]
AA=[]
B=[]
C=[]
X=[]
mod=277078100995604201
for i in range(n):
  a,b=map(int,input().split())
  if a<0:
    a=a*-1
    b=b*-1
  if a*b>0:
    A.append(b*pow(a,mod-2,mod)%mod)
  elif a*b<0:
    AA.append(a*pow((-b),mod-2,mod)%mod)
  else:
    if a==0 and b==0:
      X.append(i)
    elif a==0:
      B.append(i)
    else:
      C.append(i)
mod = 10**9+7
D=collections.Counter(A)
DD=collections.Counter(AA)
E=set(list(D)+list(DD))
a=1
for i in E:
  a=(a*(2**D[i]+2**DD[i]-1))%mod
a=(a*(2**len(B)+2**len(C)-1)-1)%mod
print((a+len(X))%mod)
# Buggy code:
from flactions import gcd 
from collections import defaultdict

def to_irreducible(a, b):
    if a == 0:
        return [0, 1]
    GCD = gcd(a, b)
    return [a//GCD, b//GCD]

MOD = 10**9 + 7
N = int(input())
daiichi_dict = defaultdict(int)
daini_dict = defaultdict(int)
zero_cases = 0

for i in range(N):
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        zero_cases += 1
    elif a * b >=0 and b != 0:
        a, b = to_irreducible(abs(a), abs(b))
        daiichi_dict[(a,b)] += 1
    else:
        a, b = to_irreducible(abs(b), abs(a))
        daini_dict[(a,b)] += 1
        daiichi_dict[(a,b)] += 0


ans = 1 
for key, value_daiichi in daiichi_dict.items():
    value_daini = daini_dict[key]
    ans *= (2**value_daiichi + 2**value_daini -1)
    ans %= MOD
print((ans+zero_cases-1) % MOD)


# Fixed code:
from math import gcd 
from collections import defaultdict

def to_irreducible(a, b):
    if a == 0:
        return [0, 1]
    GCD = gcd(a, b)
    return [a//GCD, b//GCD]

MOD = 10**9 + 7
N = int(input())
daiichi_dict = defaultdict(int)
daini_dict = defaultdict(int)
zero_cases = 0

for i in range(N):
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        zero_cases += 1
    elif a * b >=0 and b != 0:
        a, b = to_irreducible(abs(a), abs(b))
        daiichi_dict[(a,b)] += 1
    else:
        a, b = to_irreducible(abs(b), abs(a))
        daini_dict[(a,b)] += 1
        daiichi_dict[(a,b)] += 0


ans = 1 
for key, value_daiichi in daiichi_dict.items():
    value_daini = daini_dict[key]
    ans *= (2**value_daiichi + 2**value_daini -1)
    ans %= MOD
print((ans+zero_cases-1) % MOD)