fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    val d = readLine()!!.split(" ").map { it.toLong() }.toMutableList()
    d.sort()

    val median1 = d[n/2]
    val median2 = d[n/2 - 1]

    if (median1 - median2 > 0) {
        println(median1 - median2)
    } else {
        println(0)
    }
}