import java.util.*;
import java.awt.*;

class Main {

    private static Scanner sc = new Scanner(System.in);

    //ソート Arrays.sort(配列名);
    //逆順ソート Arrays.sort(配列名,  Collections.reverseOrder());


    public static void main(String[] args) {
        int n = Integer.parseInt(sc.next());
        int[] d = new int[n];
        int ans=0;

        for(int i = 0;i < n; i++){
            d[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(d);
        ans = d[n/2]-d[n/2-1];

        System.out.println(ans);
    }
} import java.util.*; util.* java import java.awt.*; awt.* java class Main {

    private static Scanner sc = new Scanner(System.in);

    //ソート Arrays.sort(配列名);
    //逆順ソート Arrays.sort(配列名,  Collections.reverseOrder());


    public static void main(String[] args) {
        int n = Integer.parseInt(sc.next());
        int[] d = new int[n];
        int ans=0;

        for(int i = 0;i < n; i++){
            d[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(d);
        ans = d[n/2]-d[n/2-1];

        System.out.println(ans);
    }
} Main private static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
        int n = Integer.parseInt(sc.next());
        int[] d = new int[n];
        int ans=0;

        for(int i = 0;i < n; i++){
            d[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(d);
        ans = d[n/2]-d[n/2-1];

        System.out.println(ans);
    } main {
        int n = Integer.parseInt(sc.next());
        int[] d = new int[n];
        int ans=0;

        for(int i = 0;i < n; i++){
            d[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(d);
        ans = d[n/2]-d[n/2-1];

        System.out.println(ans);
    } int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] d = new int[n]; d new int[n] n int ans=0; ans 0 for(int i = 0;i < n; i++){
            d[i] = Integer.parseInt(sc.next());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            d[i] = Integer.parseInt(sc.next());
        } {
            d[i] = Integer.parseInt(sc.next());
        } d[i] = Integer.parseInt(sc.next()) d[i] d i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc Arrays.sort(d) Arrays.sort Arrays d ans = d[n/2]-d[n/2-1] ans d[n/2]-d[n/2-1] d[n/2] d n/2 n 2 d[n/2-1] d n/2-1 n/2 n 2 1 System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.*;
import java.awt.*;

class Main {

    private static Scanner sc = new Scanner(System.in);

    //ソート Arrays.sort(配列名);
    //逆順ソート Arrays.sort(配列名,  Collections.reverseOrder());


    public static void main(String[] args) {
        int n = Integer.parseInt(sc.next());
        int[] d = new int[n];
        int ans=0;

        for(int i = 0;i < n; i++){
            d[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(d);
        ans = d[n/2]-d[n/2-1];

        System.out.println(ans);
    }
}
