import java.io.PrintWriter;
import java.util.*;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc  = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args){
        int N = nextInt();

        int[] d = new int[N];
        for(int i=0; i<N; i++){
            d[i] = nextInt();
        }

        Arrays.sort(d);

        int middle = N/2-1;
        int min = d[middle];
        int max = d[middle+1];

        int scope = min<=max ? max-min : 0;

        println(scope);
    }

    //各桁の和
    public static int sumDigits(long n) {
        int sum = 0;
        while (n != 0) {
            sum += n % 10;
            n /= 10;
        }
        return sum;//合計を返す
    }

    //最大公約数gcd
    static long gcd (long a, long b) {
        long temp;
        while ((temp = a % b) != 0) {
            a = b;
            b = temp;
        }
        return b;
    }
    //最小公倍数lcm
    static long lcm (long a, long b) {
        long temp;
        long c = a;
        c *= b;
        while((temp = a%b)!=0) {
            a = b;
            b = temp;
        }
        return (c/b);
    }
    static int nextInt(){
        return Integer.parseInt(next());
    }
    static Long nextLong(){
        return Long.parseLong(next());
    }
    static String next(){
        return sc.next();
    }
    static void println(Object o){
        out.println(o);
        out.flush();
    }
   static void print(Object o){
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    }
} import java.io.PrintWriter; PrintWriter java.io import java.util.*; util.* java public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc  = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args){
        int N = nextInt();

        int[] d = new int[N];
        for(int i=0; i<N; i++){
            d[i] = nextInt();
        }

        Arrays.sort(d);

        int middle = N/2-1;
        int min = d[middle];
        int max = d[middle+1];

        int scope = min<=max ? max-min : 0;

        println(scope);
    }

    //各桁の和
    public static int sumDigits(long n) {
        int sum = 0;
        while (n != 0) {
            sum += n % 10;
            n /= 10;
        }
        return sum;//合計を返す
    }

    //最大公約数gcd
    static long gcd (long a, long b) {
        long temp;
        while ((temp = a % b) != 0) {
            a = b;
            b = temp;
        }
        return b;
    }
    //最小公倍数lcm
    static long lcm (long a, long b) {
        long temp;
        long c = a;
        c *= b;
        while((temp = a%b)!=0) {
            a = b;
            b = temp;
        }
        return (c/b);
    }
    static int nextInt(){
        return Integer.parseInt(next());
    }
    static Long nextLong(){
        return Long.parseLong(next());
    }
    static String next(){
        return sc.next();
    }
    static void println(Object o){
        out.println(o);
        out.flush();
    }
   static void print(Object o){
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    }
} Main static String br = System.getProperty("line.separator"); br System.getProperty("line.separator") System.getProperty System "line.separator" static Scanner sc  = new Scanner(System.in); sc new Scanner(System.in) static PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) public static void main(String[] args){
        int N = nextInt();

        int[] d = new int[N];
        for(int i=0; i<N; i++){
            d[i] = nextInt();
        }

        Arrays.sort(d);

        int middle = N/2-1;
        int min = d[middle];
        int max = d[middle+1];

        int scope = min<=max ? max-min : 0;

        println(scope);
    } main {
        int N = nextInt();

        int[] d = new int[N];
        for(int i=0; i<N; i++){
            d[i] = nextInt();
        }

        Arrays.sort(d);

        int middle = N/2-1;
        int min = d[middle];
        int max = d[middle+1];

        int scope = min<=max ? max-min : 0;

        println(scope);
    } int N = nextInt(); N nextInt() nextInt int[] d = new int[N]; d new int[N] N for(int i=0; i<N; i++){
            d[i] = nextInt();
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            d[i] = nextInt();
        } {
            d[i] = nextInt();
        } d[i] = nextInt() d[i] d i nextInt() nextInt Arrays.sort(d) Arrays.sort Arrays d int middle = N/2-1; middle N/2-1 N/2 N 2 1 int min = d[middle]; min d[middle] d middle int max = d[middle+1]; max d[middle+1] d middle+1 middle 1 int scope = min<=max ? max-min : 0; scope min<=max ? max-min : 0 min<=max min max max-min max min 0 println(scope) println scope String[] args args //各桁の和
    public static int sumDigits(long n) {
        int sum = 0;
        while (n != 0) {
            sum += n % 10;
            n /= 10;
        }
        return sum;//合計を返す
    } sumDigits {
        int sum = 0;
        while (n != 0) {
            sum += n % 10;
            n /= 10;
        }
        return sum;//合計を返す
    } int sum = 0; sum 0 while (n != 0) {
            sum += n % 10;
            n /= 10;
        } n != 0 n 0 {
            sum += n % 10;
            n /= 10;
        } sum += n % 10 sum n % 10 n 10 n /= 10 n 10 return sum;//合計を返す sum long n n //最大公約数gcd
    static long gcd (long a, long b) {
        long temp;
        while ((temp = a % b) != 0) {
            a = b;
            b = temp;
        }
        return b;
    } gcd {
        long temp;
        while ((temp = a % b) != 0) {
            a = b;
            b = temp;
        }
        return b;
    } long temp; temp while ((temp = a % b) != 0) {
            a = b;
            b = temp;
        } (temp = a % b) != 0 (temp = a % b) temp a % b a b 0 {
            a = b;
            b = temp;
        } a = b a b b = temp b temp return b; b long a a long b b //最小公倍数lcm
    static long lcm (long a, long b) {
        long temp;
        long c = a;
        c *= b;
        while((temp = a%b)!=0) {
            a = b;
            b = temp;
        }
        return (c/b);
    } lcm {
        long temp;
        long c = a;
        c *= b;
        while((temp = a%b)!=0) {
            a = b;
            b = temp;
        }
        return (c/b);
    } long temp; temp long c = a; c a c *= b c b while((temp = a%b)!=0) {
            a = b;
            b = temp;
        } (temp = a%b)!=0 (temp = a%b) temp a%b a b 0 {
            a = b;
            b = temp;
        } a = b a b b = temp b temp return (c/b); (c/b) c b long a a long b b static int nextInt(){
        return Integer.parseInt(next());
    } nextInt {
        return Integer.parseInt(next());
    } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next static Long nextLong(){
        return Long.parseLong(next());
    } nextLong {
        return Long.parseLong(next());
    } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next static String next(){
        return sc.next();
    } next {
        return sc.next();
    } return sc.next(); sc.next() sc.next sc static void println(Object o){
        out.println(o);
        out.flush();
    } println {
        out.println(o);
        out.flush();
    } out.println(o) out.println out o out.flush() out.flush out Object o o static void print(Object o){
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    } print {
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    } PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) out.print(o) out.print out o out.flush() out.flush out Object o o public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc  = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args){
        int N = nextInt();

        int[] d = new int[N];
        for(int i=0; i<N; i++){
            d[i] = nextInt();
        }

        Arrays.sort(d);

        int middle = N/2-1;
        int min = d[middle];
        int max = d[middle+1];

        int scope = min<=max ? max-min : 0;

        println(scope);
    }

    //各桁の和
    public static int sumDigits(long n) {
        int sum = 0;
        while (n != 0) {
            sum += n % 10;
            n /= 10;
        }
        return sum;//合計を返す
    }

    //最大公約数gcd
    static long gcd (long a, long b) {
        long temp;
        while ((temp = a % b) != 0) {
            a = b;
            b = temp;
        }
        return b;
    }
    //最小公倍数lcm
    static long lcm (long a, long b) {
        long temp;
        long c = a;
        c *= b;
        while((temp = a%b)!=0) {
            a = b;
            b = temp;
        }
        return (c/b);
    }
    static int nextInt(){
        return Integer.parseInt(next());
    }
    static Long nextLong(){
        return Long.parseLong(next());
    }
    static String next(){
        return sc.next();
    }
    static void println(Object o){
        out.println(o);
        out.flush();
    }
   static void print(Object o){
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    }
} public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc  = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args){
        int N = nextInt();

        int[] d = new int[N];
        for(int i=0; i<N; i++){
            d[i] = nextInt();
        }

        Arrays.sort(d);

        int middle = N/2-1;
        int min = d[middle];
        int max = d[middle+1];

        int scope = min<=max ? max-min : 0;

        println(scope);
    }

    //各桁の和
    public static int sumDigits(long n) {
        int sum = 0;
        while (n != 0) {
            sum += n % 10;
            n /= 10;
        }
        return sum;//合計を返す
    }

    //最大公約数gcd
    static long gcd (long a, long b) {
        long temp;
        while ((temp = a % b) != 0) {
            a = b;
            b = temp;
        }
        return b;
    }
    //最小公倍数lcm
    static long lcm (long a, long b) {
        long temp;
        long c = a;
        c *= b;
        while((temp = a%b)!=0) {
            a = b;
            b = temp;
        }
        return (c/b);
    }
    static int nextInt(){
        return Integer.parseInt(next());
    }
    static Long nextLong(){
        return Long.parseLong(next());
    }
    static String next(){
        return sc.next();
    }
    static void println(Object o){
        out.println(o);
        out.flush();
    }
   static void print(Object o){
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    }
} Main
import java.io.PrintWriter;
import java.util.*;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc  = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args){
        int N = nextInt();

        int[] d = new int[N];
        for(int i=0; i<N; i++){
            d[i] = nextInt();
        }

        Arrays.sort(d);

        int middle = N/2-1;
        int min = d[middle];
        int max = d[middle+1];

        int scope = min<=max ? max-min : 0;

        println(scope);
    }

    //各桁の和
    public static int sumDigits(long n) {
        int sum = 0;
        while (n != 0) {
            sum += n % 10;
            n /= 10;
        }
        return sum;//合計を返す
    }

    //最大公約数gcd
    static long gcd (long a, long b) {
        long temp;
        while ((temp = a % b) != 0) {
            a = b;
            b = temp;
        }
        return b;
    }
    //最小公倍数lcm
    static long lcm (long a, long b) {
        long temp;
        long c = a;
        c *= b;
        while((temp = a%b)!=0) {
            a = b;
            b = temp;
        }
        return (c/b);
    }
    static int nextInt(){
        return Integer.parseInt(next());
    }
    static Long nextLong(){
        return Long.parseLong(next());
    }
    static String next(){
        return sc.next();
    }
    static void println(Object o){
        out.println(o);
        out.flush();
    }
   static void print(Object o){
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    }
}
