import java.util.Scanner

object Main {

  def solve(sc: Scanner): String = {
    val n = sc.nextInt()
    val ds = Vector.fill(n)(sc.nextInt()).sorted

    val (_lows, _highs) = ds.zipWithIndex.partition { case (_, i) => i < n / 2 }
    val lows = _lows.map(_._1)
    val highs = _highs.map(_._1)
    (highs.head - lows.last).toString
  }

  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val writer = new java.io.PrintWriter(System.out)
    writer.println(solve(sc))
    writer.flush()
  }

  private def debug(x: Any): Unit = {
    if (System.getenv("LOCAL_DEBUG") != null) println(x)
  }
}
