import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        
        int[] dificulties = new int[num];
        for(int i = 0; i < num; i++){
            dificulties[i] =  sc.nextInt();
        }
        Arrays.sort(dificulties);
        int halfNum = num / 2;
        int ans = dificulties[halfNum] - dificulties[halfNum-1];

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

        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        
        int[] dificulties = new int[num];
        for(int i = 0; i < num; i++){
            dificulties[i] =  sc.nextInt();
        }
        Arrays.sort(dificulties);
        int halfNum = num / 2;
        int ans = dificulties[halfNum] - dificulties[halfNum-1];

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

        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc int[] dificulties = new int[num]; dificulties new int[num] num for(int i = 0; i < num; i++){
            dificulties[i] =  sc.nextInt();
        } int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
            dificulties[i] =  sc.nextInt();
        } {
            dificulties[i] =  sc.nextInt();
        } dificulties[i] =  sc.nextInt() dificulties[i] dificulties i sc.nextInt() sc.nextInt sc Arrays.sort(dificulties) Arrays.sort Arrays dificulties int halfNum = num / 2; halfNum num / 2 num 2 int ans = dificulties[halfNum] - dificulties[halfNum-1]; ans dificulties[halfNum] - dificulties[halfNum-1] dificulties[halfNum] dificulties halfNum dificulties[halfNum-1] dificulties halfNum-1 halfNum 1 System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        
        int[] dificulties = new int[num];
        for(int i = 0; i < num; i++){
            dificulties[i] =  sc.nextInt();
        }
        Arrays.sort(dificulties);
        int halfNum = num / 2;
        int ans = dificulties[halfNum] - dificulties[halfNum-1];

        System.out.println(ans);
    }
}