fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val D = readLine()!!.split(" ").map(String::toInt)
    val m = D.sorted().slice(D.size / 2 - 1..D.size / 2)
    println(m[1] - m[0])
}