object Main extends App {
  val in = new java.util.Scanner(System.in)
  val N = in.nextInt
  val ABs = Array.fill(N)((in.nextInt, in.nextInt))
  val As = ABs.map(_._1).sorted
  val Bs = ABs.map(_._2).sorted

  def diff(i: Int): Int = Bs(i) - As(i)
  println(diff(N / 2) + 1 + (if (N % 2 == 1) 0 else diff(N / 2 - 1)))
}