import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();

        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            long d = sc.nextLong();
            list.add(d);
        }
        Collections.sort(list);

        int index = (list.size() - 1) / 2;
        long min = list.get(index);
        long max = list.get(index + 1);
        System.out.println(max - min);
    }
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();

        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            long d = sc.nextLong();
            list.add(d);
        }
        Collections.sort(list);

        int index = (list.size() - 1) / 2;
        long min = list.get(index);
        long max = list.get(index + 1);
        System.out.println(max - min);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();

        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            long d = sc.nextLong();
            list.add(d);
        }
        Collections.sort(list);

        int index = (list.size() - 1) / 2;
        long min = list.get(index);
        long max = list.get(index + 1);
        System.out.println(max - min);
    } main {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();

        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            long d = sc.nextLong();
            list.add(d);
        }
        Collections.sort(list);

        int index = (list.size() - 1) / 2;
        long min = list.get(index);
        long max = list.get(index + 1);
        System.out.println(max - min);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long n = sc.nextLong(); n sc.nextLong() sc.nextLong sc List<Long> list = new ArrayList<>(); list new ArrayList<>() for (int i = 0; i < n; i++) {
            long d = sc.nextLong();
            list.add(d);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            long d = sc.nextLong();
            list.add(d);
        } {
            long d = sc.nextLong();
            list.add(d);
        } long d = sc.nextLong(); d sc.nextLong() sc.nextLong sc list.add(d) list.add list d Collections.sort(list) Collections.sort Collections list int index = (list.size() - 1) / 2; index (list.size() - 1) / 2 (list.size() - 1) list.size() list.size list 1 2 long min = list.get(index); min list.get(index) list.get list index long max = list.get(index + 1); max list.get(index + 1) list.get list index + 1 index 1 System.out.println(max - min) System.out.println System.out System System.out max - min max min String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();

        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            long d = sc.nextLong();
            list.add(d);
        }
        Collections.sort(list);

        int index = (list.size() - 1) / 2;
        long min = list.get(index);
        long max = list.get(index + 1);
        System.out.println(max - min);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();

        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            long d = sc.nextLong();
            list.add(d);
        }
        Collections.sort(list);

        int index = (list.size() - 1) / 2;
        long min = list.get(index);
        long max = list.get(index + 1);
        System.out.println(max - min);
    }
} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();

        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            long d = sc.nextLong();
            list.add(d);
        }
        Collections.sort(list);

        int index = (list.size() - 1) / 2;
        long min = list.get(index);
        long max = list.get(index + 1);
        System.out.println(max - min);
    }
}