"use strict";
const main = input => {
    const n = parseInt(input[0], 10);
    let d = input[1].split(' ');
    let value;
    for(let i=0; i<n; i++) d[i] = parseInt(d[i], 10);
    for(let i=0; i<n/2+1; i++) {
        for(let k=i+1; k<n; k++) {
            if (d[i] > d[k]) {
                value = d[i];
                d[i] = d[k];
                d[k] = value;
            }
        }
    }
    console.log(d[n/2]-d[n/2-1]);    
}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));