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())
  
  isEven = n % 2 == 0
  
  min = 10**9
  min2 = 10**9
  min3 = 10**9
  max = -1
  max2 = -1
  max3 = -1
  
  values = []
  candidate = []
  for i in range(n):
      a, b = map(int, input().split())
  
      if a < min:
          min3 = min2
          min2 = min
          min = a
      elif a < min2:
          min3 = min2
          min2 = a
      elif a < min3:
          min3 = a
  
      if b > max:
          max3 = max2
          max2 = max
          max = b
      elif b > max2:
          max3 = max2
          max2 = b
      elif b > max3:
          max3 = b
  
  
  if not isEven:
      print(max2 - min2 + 1)
  else:
      if n == 2:
          print(max - min + 1)
      else:
          newMin = min2 + min3
          newMax = max2 + max3
          print(newMax - newMin + 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"}]