import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug == false) {
            return;
        }
        System.out.println(str);
    }

    public static void main(String[] args) {

        int  N;
        int[] pList;
        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            pList = new int[N];
            for(int i =0 ; i < N;i++){
                pList[i] = sc.nextInt();
            }
        }

        PriorityQueue<Integer> queue = new PriorityQueue<>();
        for(int i : pList){
            queue.add(i);
        }
        int h = N /2;
        int under = 0;
        int top = 0;
        for(int i = 0;i < h;i++){
            under = queue.poll();
        }
        top = queue.poll();


        debug(under+"");
        debug(top+"");
        int result = 0;
        if(under <top){
            result = top -under;
        }
        System.out.println(result);

    }

} import java.util.PriorityQueue; PriorityQueue java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug == false) {
            return;
        }
        System.out.println(str);
    }

    public static void main(String[] args) {

        int  N;
        int[] pList;
        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            pList = new int[N];
            for(int i =0 ; i < N;i++){
                pList[i] = sc.nextInt();
            }
        }

        PriorityQueue<Integer> queue = new PriorityQueue<>();
        for(int i : pList){
            queue.add(i);
        }
        int h = N /2;
        int under = 0;
        int top = 0;
        for(int i = 0;i < h;i++){
            under = queue.poll();
        }
        top = queue.poll();


        debug(under+"");
        debug(top+"");
        int result = 0;
        if(under <top){
            result = top -under;
        }
        System.out.println(result);

    }

} Main public static void debug(String str) {
        boolean debug = false;
        if (debug == false) {
            return;
        }
        System.out.println(str);
    } debug {
        boolean debug = false;
        if (debug == false) {
            return;
        }
        System.out.println(str);
    } boolean debug = false; debug false if (debug == false) {
            return;
        } debug == false debug false {
            return;
        } return; System.out.println(str) System.out.println System.out System System.out str String str str public static void main(String[] args) {

        int  N;
        int[] pList;
        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            pList = new int[N];
            for(int i =0 ; i < N;i++){
                pList[i] = sc.nextInt();
            }
        }

        PriorityQueue<Integer> queue = new PriorityQueue<>();
        for(int i : pList){
            queue.add(i);
        }
        int h = N /2;
        int under = 0;
        int top = 0;
        for(int i = 0;i < h;i++){
            under = queue.poll();
        }
        top = queue.poll();


        debug(under+"");
        debug(top+"");
        int result = 0;
        if(under <top){
            result = top -under;
        }
        System.out.println(result);

    } main {

        int  N;
        int[] pList;
        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            pList = new int[N];
            for(int i =0 ; i < N;i++){
                pList[i] = sc.nextInt();
            }
        }

        PriorityQueue<Integer> queue = new PriorityQueue<>();
        for(int i : pList){
            queue.add(i);
        }
        int h = N /2;
        int under = 0;
        int top = 0;
        for(int i = 0;i < h;i++){
            under = queue.poll();
        }
        top = queue.poll();


        debug(under+"");
        debug(top+"");
        int result = 0;
        if(under <top){
            result = top -under;
        }
        System.out.println(result);

    } int  N; N int[] pList; pList try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            pList = new int[N];
            for(int i =0 ; i < N;i++){
                pList[i] = sc.nextInt();
            }
        } {
            N = sc.nextInt();
            pList = new int[N];
            for(int i =0 ; i < N;i++){
                pList[i] = sc.nextInt();
            }
        } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) N = sc.nextInt() N sc.nextInt() sc.nextInt sc pList = new int[N] pList new int[N] N for(int i =0 ; i < N;i++){
                pList[i] = sc.nextInt();
            } int i =0 ; int i =0 ; i 0 i < N i N i++ i++ i {
                pList[i] = sc.nextInt();
            } {
                pList[i] = sc.nextInt();
            } pList[i] = sc.nextInt() pList[i] pList i sc.nextInt() sc.nextInt sc PriorityQueue<Integer> queue = new PriorityQueue<>(); queue new PriorityQueue<>() for(int i : pList){
            queue.add(i);
        } int i pList {
            queue.add(i);
        } {
            queue.add(i);
        } queue.add(i) queue.add queue i int h = N /2; h N /2 N 2 int under = 0; under 0 int top = 0; top 0 for(int i = 0;i < h;i++){
            under = queue.poll();
        } int i = 0; int i = 0; i 0 i < h i h i++ i++ i {
            under = queue.poll();
        } {
            under = queue.poll();
        } under = queue.poll() under queue.poll() queue.poll queue top = queue.poll() top queue.poll() queue.poll queue debug(under+"") debug under+"" under "" debug(top+"") debug top+"" top "" int result = 0; result 0 if(under <top){
            result = top -under;
        } under <top under top {
            result = top -under;
        } result = top -under result top -under top under System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug == false) {
            return;
        }
        System.out.println(str);
    }

    public static void main(String[] args) {

        int  N;
        int[] pList;
        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            pList = new int[N];
            for(int i =0 ; i < N;i++){
                pList[i] = sc.nextInt();
            }
        }

        PriorityQueue<Integer> queue = new PriorityQueue<>();
        for(int i : pList){
            queue.add(i);
        }
        int h = N /2;
        int under = 0;
        int top = 0;
        for(int i = 0;i < h;i++){
            under = queue.poll();
        }
        top = queue.poll();


        debug(under+"");
        debug(top+"");
        int result = 0;
        if(under <top){
            result = top -under;
        }
        System.out.println(result);

    }

} public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug == false) {
            return;
        }
        System.out.println(str);
    }

    public static void main(String[] args) {

        int  N;
        int[] pList;
        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            pList = new int[N];
            for(int i =0 ; i < N;i++){
                pList[i] = sc.nextInt();
            }
        }

        PriorityQueue<Integer> queue = new PriorityQueue<>();
        for(int i : pList){
            queue.add(i);
        }
        int h = N /2;
        int under = 0;
        int top = 0;
        for(int i = 0;i < h;i++){
            under = queue.poll();
        }
        top = queue.poll();


        debug(under+"");
        debug(top+"");
        int result = 0;
        if(under <top){
            result = top -under;
        }
        System.out.println(result);

    }

} Main
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug == false) {
            return;
        }
        System.out.println(str);
    }

    public static void main(String[] args) {

        int  N;
        int[] pList;
        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            pList = new int[N];
            for(int i =0 ; i < N;i++){
                pList[i] = sc.nextInt();
            }
        }

        PriorityQueue<Integer> queue = new PriorityQueue<>();
        for(int i : pList){
            queue.add(i);
        }
        int h = N /2;
        int under = 0;
        int top = 0;
        for(int i = 0;i < h;i++){
            under = queue.poll();
        }
        top = queue.poll();


        debug(under+"");
        debug(top+"");
        int result = 0;
        if(under <top){
            result = top -under;
        }
        System.out.println(result);

    }

}
