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

class Main {
    public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] d = new int[n];
        for (int i = 0; i < n; i++) {
            d[i] = scan.nextInt();
        }
        Arrays.sort(d);
        int half = d.length/2;
        System.out.println(d[half]- d[half-1]);
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util class Main {
    public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] d = new int[n];
        for (int i = 0; i < n; i++) {
            d[i] = scan.nextInt();
        }
        Arrays.sort(d);
        int half = d.length/2;
        System.out.println(d[half]- d[half-1]);
    }
} Main public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] d = new int[n];
        for (int i = 0; i < n; i++) {
            d[i] = scan.nextInt();
        }
        Arrays.sort(d);
        int half = d.length/2;
        System.out.println(d[half]- d[half-1]);
    } main {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] d = new int[n];
        for (int i = 0; i < n; i++) {
            d[i] = scan.nextInt();
        }
        Arrays.sort(d);
        int half = d.length/2;
        System.out.println(d[half]- d[half-1]);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] d = new int[n]; d new int[n] n for (int i = 0; i < n; i++) {
            d[i] = scan.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            d[i] = scan.nextInt();
        } {
            d[i] = scan.nextInt();
        } d[i] = scan.nextInt() d[i] d i scan.nextInt() scan.nextInt scan Arrays.sort(d) Arrays.sort Arrays d int half = d.length/2; half d.length/2 d.length d d.length 2 System.out.println(d[half]- d[half-1]) System.out.println System.out System System.out d[half]- d[half-1] d[half] d half d[half-1] d half-1 half 1 final String[] args args
import java.util.Arrays;
import java.util.Scanner;

class Main {
    public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] d = new int[n];
        for (int i = 0; i < n; i++) {
            d[i] = scan.nextInt();
        }
        Arrays.sort(d);
        int half = d.length/2;
        System.out.println(d[half]- d[half-1]);
    }
}