
import java.util.*;


public class Main {

    private static final int INF = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

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

        long halfl = list.get(n/2-1);
        long halfh = list.get(n/2);

        long result = halfh - halfl;

        System.out.println(result);



    }
} import java.util.*; util.* java public class Main {

    private static final int INF = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

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

        long halfl = list.get(n/2-1);
        long halfh = list.get(n/2);

        long result = halfh - halfl;

        System.out.println(result);



    }
} Main private static final int INF = Integer.MAX_VALUE; INF Integer.MAX_VALUE Integer Integer.MAX_VALUE public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

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

        long halfl = list.get(n/2-1);
        long halfh = list.get(n/2);

        long result = halfh - halfl;

        System.out.println(result);



    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

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

        long halfl = list.get(n/2-1);
        long halfh = list.get(n/2);

        long result = halfh - halfl;

        System.out.println(result);



    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc List<Long> list = new ArrayList<>(); list new ArrayList<>() for(int tmp = 0; tmp< n; tmp++){
            long a = sc.nextInt();
            list.add(a);
        } int tmp = 0; int tmp = 0; tmp 0 tmp< n tmp n tmp++ tmp++ tmp {
            long a = sc.nextInt();
            list.add(a);
        } {
            long a = sc.nextInt();
            list.add(a);
        } long a = sc.nextInt(); a sc.nextInt() sc.nextInt sc list.add(a) list.add list a Collections.sort(list) Collections.sort Collections list long halfl = list.get(n/2-1); halfl list.get(n/2-1) list.get list n/2-1 n/2 n 2 1 long halfh = list.get(n/2); halfh list.get(n/2) list.get list n/2 n 2 long result = halfh - halfl; result halfh - halfl halfh halfl System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {

    private static final int INF = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

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

        long halfl = list.get(n/2-1);
        long halfh = list.get(n/2);

        long result = halfh - halfl;

        System.out.println(result);



    }
} public class Main {

    private static final int INF = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

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

        long halfl = list.get(n/2-1);
        long halfh = list.get(n/2);

        long result = halfh - halfl;

        System.out.println(result);



    }
} Main

import java.util.*;


public class Main {

    private static final int INF = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

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

        long halfl = list.get(n/2-1);
        long halfh = list.get(n/2);

        long result = halfh - halfl;

        System.out.println(result);



    }
}
