fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val d = readLine()!!.split(' ').map { it.toInt() }.toIntArray()
    var difficult = mutableSetOf<Int>()
    var testNum = mutableMapOf<Int, Int>()
    for (i in 0 until d.lastIndex) {
        difficult.add(d[i])
        if (testNum.containsKey(d[i])) {
            testNum[d[i]]!!.inc()
        } else {
            testNum[d[i]] = 1
        }
    }
    val testLevel = d.sorted()
    if (testLevel[(d.size.div(2) - 1)] == testLevel[(d.size.div(2))]) {
        println(0)
    } else {
        println(testLevel[(d.size.div(2))] - testLevel[(d.size.div(2) - 1)])
    }
}
