function main(input) {
    input = input.split("\n");
    var n = parseInt(input[0]);
    var ds = input[1].split(" ").map((v) => parseInt(v, 10));

    var previousHalf = ds.sort((a, b) => a - b).splice(0,ds.length / 2);
    console.log(ds[0] - previousHalf[previousHalf.length - 1]);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
