Problem:
Score : 300 points

Problem Statement

Takahashi made N problems for competitive programming.
The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).

He is dividing the problems into two categories by choosing an integer K, as follows:

A problem with difficulty K or higher will be for ARCs.

A problem with difficulty lower than K will be for ABCs.

How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?

Problem Statement

2 \leq N \leq 10^5

N is an even number.

1 \leq d_i \leq 10^5

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
d_1 d_2 ... d_N

Output

Print the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.

Sample Input 1

6
9 1 4 4 6 7

Sample Output 1

2

If we choose K=5 or 6, Problem 1, 5, and 6 will be for ARCs, Problem 2, 3, and 4 will be for ABCs, and the objective is achieved.
Thus, the answer is 2.

Sample Input 2

8
9 1 14 5 5 4 4 14

Sample Output 2

0

There may be no choice of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.

Sample Input 3

14
99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1

Sample Output 3

42685

Solution in Rust (1.15.1) (judge verdict: Accepted)

#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(non_upper_case_globals)]


macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [$t:tt]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}


#[cfg(debug_assertions)]
macro_rules! mydbg {
    //($arg:expr) => (dbg!($arg))
    ($arg:expr) => (println!("{:?}",$arg));
}


#[cfg(not(debug_assertions))]
macro_rules! mydbg {
    ($($arg:expr),*) => {};
}


use std::cmp;
use std::collections::HashMap;



use std::ops::{ Add, Sub , Div , Mul };
static global_mod : i64 = 1000000007;

#[derive(Debug,Copy,Clone)]
pub struct ModInt {
    x : i64
}

impl ModInt{
    pub fn  new (p:i64) -> Self {
        let a = (p % global_mod + global_mod)% global_mod;     
        return ModInt{x:a};
    }

    pub fn inv (self) -> Self{
        return self.pow(global_mod-2);

    }

    pub fn pow (self , t:i64) -> Self{
        if(t==0 ) {return ModInt::new(1)};
        let mut a = self.pow(t>>1);
        a = a*a;
        if(t&1 != 0) {a = a* self};
        return a;
    }
}
impl Add for ModInt {
    type Output = ModInt;
    fn add(self,other : ModInt) -> ModInt{
        let ret  = self.x + other.x ;
        return ModInt::new(ret);
    }
}
impl Sub for ModInt {
    type Output = ModInt;
    fn sub(self,other : ModInt) -> ModInt{
        let ret  = self.x - other.x;
        return ModInt::new(ret);
    }
}
impl Mul for ModInt {
    type Output = ModInt;
    fn mul(self,other : ModInt) -> ModInt{
        let ret  = self.x * other.x ;
        return ModInt::new(ret);
    }
}

impl Div for ModInt {
    type Output = ModInt;
    fn div(self,other : ModInt) -> ModInt{
        let ret  = self.x * other.inv().x;
       return ModInt::new(ret);
    }
}

impl std::string::ToString for ModInt{
    fn to_string(&self) -> String{
        return self.x.to_string();
    }
}


pub struct Combination{
    fact : Vec<ModInt>,
    ifact : Vec<ModInt>
}

impl Combination{
    pub fn new(n:i32)->Self{
        let mut fact = vec![ModInt::new(0);(n+1) as usize];
        let mut ifact = vec![ModInt::new(0);(n+1) as usize];
        fact[0] = ModInt::new(1);
        for i in 1..n+1 { fact[i as usize] = fact[(i-1) as usize] * ModInt::new(i as i64) };
        ifact[n as usize] = fact[n as usize].inv();
        for i in (1..n+1).rev(){ ifact[(i-1) as usize] = ifact[i as usize]* ModInt::new(i as i64) }


        let a = Combination{
            fact : fact,
            ifact : ifact
        };
        return a;
    }

    pub fn gen(self , n:i32 , k:i32)-> ModInt{
        mydbg!(self.fact[n as usize]);
        mydbg!(self.ifact[k as usize]);
        mydbg!(self.ifact[(n-k) as usize]);
        if (k < 0 || k > n) {return ModInt::new(0 as i64)};
        return self.fact[n as usize]*self.ifact[k as usize]*self.ifact[(n-k) as usize];

    }
}




fn main() {

    input! { 
       n: usize,
       d: [i32;n],
    }

    
    
    
    let mut d2 = d.clone();
    d2.sort();
    let pos = d2.len()/2;
    let l = d2[pos-1];
    let g = d2[pos];

   
   
    let mut ans = 0;
    for i in l+1..g+1{
        ans += 1;
    }

    
    
    println!("{}",ans);




}