import java.util.*;

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

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