import java.util.*;

public class Main{
    public static void main(String[] args){
    //入力
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] D = new int[N];
        for(int i=0;i<N;i++){
            D[i] = sc.nextInt();
        }
    //処理
        Arrays.sort(D);
        System.out.println(D[N/2]-D[N/2-1]);

        sc.close();

    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
    //入力
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] D = new int[N];
        for(int i=0;i<N;i++){
            D[i] = sc.nextInt();
        }
    //処理
        Arrays.sort(D);
        System.out.println(D[N/2]-D[N/2-1]);

        sc.close();

    }
} Main public static void main(String[] args){
    //入力
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] D = new int[N];
        for(int i=0;i<N;i++){
            D[i] = sc.nextInt();
        }
    //処理
        Arrays.sort(D);
        System.out.println(D[N/2]-D[N/2-1]);

        sc.close();

    } main {
    //入力
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] D = new int[N];
        for(int i=0;i<N;i++){
            D[i] = sc.nextInt();
        }
    //処理
        Arrays.sort(D);
        System.out.println(D[N/2]-D[N/2-1]);

        sc.close();

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] D = new int[N]; D new int[N] N for(int i=0;i<N;i++){
            D[i] = sc.nextInt();
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            D[i] = sc.nextInt();
        } {
            D[i] = sc.nextInt();
        } D[i] = sc.nextInt() D[i] D i sc.nextInt() sc.nextInt sc Arrays.sort(D) Arrays.sort Arrays D System.out.println(D[N/2]-D[N/2-1]) System.out.println System.out System System.out 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 sc.close() sc.close sc String[] args args public class Main{
    public static void main(String[] args){
    //入力
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] D = new int[N];
        for(int i=0;i<N;i++){
            D[i] = sc.nextInt();
        }
    //処理
        Arrays.sort(D);
        System.out.println(D[N/2]-D[N/2-1]);

        sc.close();

    }
} public class Main{
    public static void main(String[] args){
    //入力
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] D = new int[N];
        for(int i=0;i<N;i++){
            D[i] = sc.nextInt();
        }
    //処理
        Arrays.sort(D);
        System.out.println(D[N/2]-D[N/2-1]);

        sc.close();

    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
    //入力
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] D = new int[N];
        for(int i=0;i<N;i++){
            D[i] = sc.nextInt();
        }
    //処理
        Arrays.sort(D);
        System.out.println(D[N/2]-D[N/2-1]);

        sc.close();

    }
}
