output_description: Print the answer.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      A_1 B_1
      A_2 B_2
      :
      A_N B_N
attempt: from bisect import bisect_left
  
  N = int(input())
  
  AB = [tuple(map(int, input().split())) for _ in range(N)]
  ALL = []
  ALL_append = ALL.append
  for a, b in AB:
      ALL_append(a)
      ALL_append(b)
  
  ALL.sort()
  dic = dict()
  for i, x in enumerate(ALL):
      dic[x] = i
  
  lst1 = [0] * (2 * N + 1)
  lst2 = [0] * (2 * N + 1)
  
  for a, b in AB:
      lst1[dic[a]] += 1
      lst2[dic[b]] -= 1
  
  for i in range(2 * N):
      lst1[i + 1] += lst1[i]
      lst2[2 * N - 1 - i] += lst2[2 * N - i]
  
  # print (lst1)
  # print (lst2)
  
  if N % 2 == 1:  # 奇数 -->一意に決まる時
      left = bisect_left(lst1, N // 2 + 0.5)
      right = bisect_left(lst2, -((N) // 2) - 0.5) - 1
      # print (left, right)
      upper = ALL[right]
      lower = ALL[left]
      print(upper - lower + 1)
  else:
      left = bisect_left(lst1, N // 2 - 0.5)
      right = bisect_left(lst2, -(N // 2) - 0.5)
      # print (left, right)
      upper = ALL[right]
      lower = ALL[left]
      print(upper - lower + 1)
  
problem_description: Statement
  
  There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq
  B_i. Find the number of different values that the median of X_1, X_2, \cdots,
  X_N can take.
samples: [{"input": "2\n    1 2\n    2 3", "output": "3\n    \n\n  * If X_1 = 1 and X_2 = 2, the median is \\frac{3}{2};\n\n  * if X_1 = 1 and X_2 = 3, the median is 2;\n\n  * if X_1 = 2 and X_2 = 2, the median is 2;\n\n  * if X_1 = 2 and X_2 = 3, the median is \\frac{5}{2}.\n\nThus, the median can take three values: \\frac{3}{2}, 2, and \\frac{5}{2}.\n\n* * *"}, {"input": "3\n    100 100\n    10 10000\n    1 1000000000", "output": "9991"}]