import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val d = (1..n).map { sc.nextInt() }

  println(abc132c(n, d))
}

private fun abc132c(n: Int, d: List<Int>): Int {
  val sorted = d.sorted()

  val first = sorted.subList(0, n / 2)
  val second = sorted.subList(n / 2, n)

  val max = first.max()!!
  val min = second.min()!!

  return min - max
}
