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: n = int(input())
  buf = []
  for i in range(n):
      a, b = map(int, input().split())
      buf.append([a, b])
  
  if n % 2 == 0:
      nec = n // 2
  else:
      nec = n // 2 + 1
  
  lbuf = buf.copy()
  rbuf = buf.copy()
  
  lbuf.sort(key=lambda x: x[0])
  rbuf.sort(key=lambda x: x[1])
  
  rind = 0
  lbods = []
  
  pos = 0
  fix = 0
  for i in range(n):
      temp = lbuf[i][0]
      pos += 1
      if rind < n:
          while rbuf[rind][1] <= temp:
              fix += 1
              rind += 1
              if rind == n:
                  break
  
      lbods.append([temp, pos, fix])
  
  
  lbuf.sort(key=lambda x: -x[0])
  rbuf.sort(key=lambda x: -x[1])
  
  lind = 0
  rbods = []
  
  pos = 0
  fix = 0
  for i in range(n):
      temp = rbuf[i][1]
      pos += 1
      if lind < n:
          while lbuf[lind][0] >= temp:
              fix += 1
              lind += 1
              if lind == n:
                  break
  
      rbods.append([temp, pos, fix])
  
  # print(lbods)
  # print(rbods)
  
  lb = 0
  rb = 0
  for i in range(n):
      if lbods[i][1] == nec:
          lb = lbods[i][0]
          break
  
  for i in range(n):
      if rbods[i][1] == nec:
          rb = rbods[i][0]
          break
  
  print(rb - lb + 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"}]