import java.util.Arrays;
import java.util.Scanner;

class Solver {
    void solve(Scanner sc) {
        int N = sc.nextInt();
        int[] difficulty = new int[N];
        for (int i = 0; i < N; i++) {
            difficulty[i] = sc.nextInt();
        }
        Arrays.sort(difficulty);
        int a = difficulty[(difficulty.length - 1) / 2];
        int b = difficulty[(difficulty.length - 1) / 2 + 1];
        System.out.println(b - a);
    }
}

class Main {
    public static void main(String... args) {
        Scanner in = new Scanner(System.in);

        new Solver().solve(in);

        in.close();
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util class Solver {
    void solve(Scanner sc) {
        int N = sc.nextInt();
        int[] difficulty = new int[N];
        for (int i = 0; i < N; i++) {
            difficulty[i] = sc.nextInt();
        }
        Arrays.sort(difficulty);
        int a = difficulty[(difficulty.length - 1) / 2];
        int b = difficulty[(difficulty.length - 1) / 2 + 1];
        System.out.println(b - a);
    }
} Solver void solve(Scanner sc) {
        int N = sc.nextInt();
        int[] difficulty = new int[N];
        for (int i = 0; i < N; i++) {
            difficulty[i] = sc.nextInt();
        }
        Arrays.sort(difficulty);
        int a = difficulty[(difficulty.length - 1) / 2];
        int b = difficulty[(difficulty.length - 1) / 2 + 1];
        System.out.println(b - a);
    } solve {
        int N = sc.nextInt();
        int[] difficulty = new int[N];
        for (int i = 0; i < N; i++) {
            difficulty[i] = sc.nextInt();
        }
        Arrays.sort(difficulty);
        int a = difficulty[(difficulty.length - 1) / 2];
        int b = difficulty[(difficulty.length - 1) / 2 + 1];
        System.out.println(b - a);
    } int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] difficulty = new int[N]; difficulty new int[N] N for (int i = 0; i < N; i++) {
            difficulty[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            difficulty[i] = sc.nextInt();
        } {
            difficulty[i] = sc.nextInt();
        } difficulty[i] = sc.nextInt() difficulty[i] difficulty i sc.nextInt() sc.nextInt sc Arrays.sort(difficulty) Arrays.sort Arrays difficulty int a = difficulty[(difficulty.length - 1) / 2]; a difficulty[(difficulty.length - 1) / 2] difficulty (difficulty.length - 1) / 2 (difficulty.length - 1) difficulty.length difficulty difficulty.length 1 2 int b = difficulty[(difficulty.length - 1) / 2 + 1]; b difficulty[(difficulty.length - 1) / 2 + 1] difficulty (difficulty.length - 1) / 2 + 1 (difficulty.length - 1) / 2 (difficulty.length - 1) difficulty.length difficulty difficulty.length 1 2 1 System.out.println(b - a) System.out.println System.out System System.out b - a b a Scanner sc sc class Main {
    public static void main(String... args) {
        Scanner in = new Scanner(System.in);

        new Solver().solve(in);

        in.close();
    }
} Main public static void main(String... args) {
        Scanner in = new Scanner(System.in);

        new Solver().solve(in);

        in.close();
    } main {
        Scanner in = new Scanner(System.in);

        new Solver().solve(in);

        in.close();
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) new Solver().solve(in) new Solver().solve new Solver() in in.close() in.close in String... args args
import java.util.Arrays;
import java.util.Scanner;

class Solver {
    void solve(Scanner sc) {
        int N = sc.nextInt();
        int[] difficulty = new int[N];
        for (int i = 0; i < N; i++) {
            difficulty[i] = sc.nextInt();
        }
        Arrays.sort(difficulty);
        int a = difficulty[(difficulty.length - 1) / 2];
        int b = difficulty[(difficulty.length - 1) / 2 + 1];
        System.out.println(b - a);
    }
}

class Main {
    public static void main(String... args) {
        Scanner in = new Scanner(System.in);

        new Solver().solve(in);

        in.close();
    }
}