import scala.io.StdIn

object Main extends App {
  val n  = StdIn.readLine().toInt
  val p :Array[Int] = StdIn.readLine().split(" ").map(_.toInt).sorted

  def solve(n: Int, p: Array[Int]): Int = {
    val m = n / 2
    if (p(m - 1) == p(m)) 0
    else if (p(m - 1) + 1 == p(m)) 1
    else p(m) - p(m - 1)
  }

  println(solve(n, p))
}
  

