import java.util.Scanner;
import java.util.HashMap;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;

public class Main {

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

    public static void main(String[] args) {
       int n = sc.nextInt();
       int[] d = new int[n];
       for (int i = 0; i < n; i++) {
           d[i] = sc.nextInt();
       }
       int ans = 0;
       Arrays.sort(d);
       int b = d[n/2];
       int c = d[n/2 - 1];
       System.out.println(b-c);
    }

} import java.util.Scanner; Scanner java.util import java.util.HashMap; HashMap java.util import java.util.List; List java.util import java.util.Arrays; Arrays java.util import java.util.ArrayList; ArrayList java.util import java.lang.Math; Math java.lang public class Main {

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

    public static void main(String[] args) {
       int n = sc.nextInt();
       int[] d = new int[n];
       for (int i = 0; i < n; i++) {
           d[i] = sc.nextInt();
       }
       int ans = 0;
       Arrays.sort(d);
       int b = d[n/2];
       int c = d[n/2 - 1];
       System.out.println(b-c);
    }

} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
       int n = sc.nextInt();
       int[] d = new int[n];
       for (int i = 0; i < n; i++) {
           d[i] = sc.nextInt();
       }
       int ans = 0;
       Arrays.sort(d);
       int b = d[n/2];
       int c = d[n/2 - 1];
       System.out.println(b-c);
    } main {
       int n = sc.nextInt();
       int[] d = new int[n];
       for (int i = 0; i < n; i++) {
           d[i] = sc.nextInt();
       }
       int ans = 0;
       Arrays.sort(d);
       int b = d[n/2];
       int c = d[n/2 - 1];
       System.out.println(b-c);
    } 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 int ans = 0; ans 0 Arrays.sort(d) Arrays.sort Arrays d int b = d[n/2]; b d[n/2] d n/2 n 2 int c = d[n/2 - 1]; c d[n/2 - 1] d n/2 - 1 n/2 n 2 1 System.out.println(b-c) System.out.println System.out System System.out b-c b c String[] args args public class Main {

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

    public static void main(String[] args) {
       int n = sc.nextInt();
       int[] d = new int[n];
       for (int i = 0; i < n; i++) {
           d[i] = sc.nextInt();
       }
       int ans = 0;
       Arrays.sort(d);
       int b = d[n/2];
       int c = d[n/2 - 1];
       System.out.println(b-c);
    }

} public class Main {

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

    public static void main(String[] args) {
       int n = sc.nextInt();
       int[] d = new int[n];
       for (int i = 0; i < n; i++) {
           d[i] = sc.nextInt();
       }
       int ans = 0;
       Arrays.sort(d);
       int b = d[n/2];
       int c = d[n/2 - 1];
       System.out.println(b-c);
    }

} Main
import java.util.Scanner;
import java.util.HashMap;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;

public class Main {

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

    public static void main(String[] args) {
       int n = sc.nextInt();
       int[] d = new int[n];
       for (int i = 0; i < n; i++) {
           d[i] = sc.nextInt();
       }
       int ans = 0;
       Arrays.sort(d);
       int b = d[n/2];
       int c = d[n/2 - 1];
       System.out.println(b-c);
    }

}
