import java.util.*;


class Main{
    public static void main(String argv[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] p = new int[n];
        for(int i=0;i<n;i++){
            p[i]=sc.nextInt();
        }

        Arrays.sort(p);
        int K = p[n/2] - p[n/2-1];
        System.out.println(K);
    }
} import java.util.*; util.* java class Main{
    public static void main(String argv[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] p = new int[n];
        for(int i=0;i<n;i++){
            p[i]=sc.nextInt();
        }

        Arrays.sort(p);
        int K = p[n/2] - p[n/2-1];
        System.out.println(K);
    }
} Main public static void main(String argv[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] p = new int[n];
        for(int i=0;i<n;i++){
            p[i]=sc.nextInt();
        }

        Arrays.sort(p);
        int K = p[n/2] - p[n/2-1];
        System.out.println(K);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] p = new int[n];
        for(int i=0;i<n;i++){
            p[i]=sc.nextInt();
        }

        Arrays.sort(p);
        int K = p[n/2] - p[n/2-1];
        System.out.println(K);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] p = new int[n]; p new int[n] n for(int i=0;i<n;i++){
            p[i]=sc.nextInt();
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            p[i]=sc.nextInt();
        } {
            p[i]=sc.nextInt();
        } p[i]=sc.nextInt() p[i] p i sc.nextInt() sc.nextInt sc Arrays.sort(p) Arrays.sort Arrays p int K = p[n/2] - p[n/2-1]; K p[n/2] - p[n/2-1] p[n/2] p n/2 n 2 p[n/2-1] p n/2-1 n/2 n 2 1 System.out.println(K) System.out.println System.out System System.out K String argv[] argv
import java.util.*;


class Main{
    public static void main(String argv[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] p = new int[n];
        for(int i=0;i<n;i++){
            p[i]=sc.nextInt();
        }

        Arrays.sort(p);
        int K = p[n/2] - p[n/2-1];
        System.out.println(K);
    }
}