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

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        int n = std.nextInt();
        int[] d = new int[n];
        for (int i = 0; i < n; i++) {
            d[i] = std.nextInt();
        }

        PriorityQueue<Integer> pq = new PriorityQueue<>(n);
        for (int i = 0; i < n; i++) {
            pq.add(d[i]);
        }

        int divCount = n / 2;

        int value = 0;
        for (int i = 0; i < divCount; i++) {
            value = pq.poll();
        }

        int nextValue = pq.poll();

        int totalCount = nextValue - value;
        System.out.println(totalCount);
    }
} import java.util.PriorityQueue; PriorityQueue java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        int n = std.nextInt();
        int[] d = new int[n];
        for (int i = 0; i < n; i++) {
            d[i] = std.nextInt();
        }

        PriorityQueue<Integer> pq = new PriorityQueue<>(n);
        for (int i = 0; i < n; i++) {
            pq.add(d[i]);
        }

        int divCount = n / 2;

        int value = 0;
        for (int i = 0; i < divCount; i++) {
            value = pq.poll();
        }

        int nextValue = pq.poll();

        int totalCount = nextValue - value;
        System.out.println(totalCount);
    }
} Main public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        int n = std.nextInt();
        int[] d = new int[n];
        for (int i = 0; i < n; i++) {
            d[i] = std.nextInt();
        }

        PriorityQueue<Integer> pq = new PriorityQueue<>(n);
        for (int i = 0; i < n; i++) {
            pq.add(d[i]);
        }

        int divCount = n / 2;

        int value = 0;
        for (int i = 0; i < divCount; i++) {
            value = pq.poll();
        }

        int nextValue = pq.poll();

        int totalCount = nextValue - value;
        System.out.println(totalCount);
    } main {
        Scanner std = new Scanner(System.in);
        int n = std.nextInt();
        int[] d = new int[n];
        for (int i = 0; i < n; i++) {
            d[i] = std.nextInt();
        }

        PriorityQueue<Integer> pq = new PriorityQueue<>(n);
        for (int i = 0; i < n; i++) {
            pq.add(d[i]);
        }

        int divCount = n / 2;

        int value = 0;
        for (int i = 0; i < divCount; i++) {
            value = pq.poll();
        }

        int nextValue = pq.poll();

        int totalCount = nextValue - value;
        System.out.println(totalCount);
    } Scanner std = new Scanner(System.in); std new Scanner(System.in) int n = std.nextInt(); n std.nextInt() std.nextInt std int[] d = new int[n]; d new int[n] n for (int i = 0; i < n; i++) {
            d[i] = std.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            d[i] = std.nextInt();
        } {
            d[i] = std.nextInt();
        } d[i] = std.nextInt() d[i] d i std.nextInt() std.nextInt std PriorityQueue<Integer> pq = new PriorityQueue<>(n); pq new PriorityQueue<>(n) for (int i = 0; i < n; i++) {
            pq.add(d[i]);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            pq.add(d[i]);
        } {
            pq.add(d[i]);
        } pq.add(d[i]) pq.add pq d[i] d i int divCount = n / 2; divCount n / 2 n 2 int value = 0; value 0 for (int i = 0; i < divCount; i++) {
            value = pq.poll();
        } int i = 0; int i = 0; i 0 i < divCount i divCount i++ i++ i {
            value = pq.poll();
        } {
            value = pq.poll();
        } value = pq.poll() value pq.poll() pq.poll pq int nextValue = pq.poll(); nextValue pq.poll() pq.poll pq int totalCount = nextValue - value; totalCount nextValue - value nextValue value System.out.println(totalCount) System.out.println System.out System System.out totalCount String[] args args public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        int n = std.nextInt();
        int[] d = new int[n];
        for (int i = 0; i < n; i++) {
            d[i] = std.nextInt();
        }

        PriorityQueue<Integer> pq = new PriorityQueue<>(n);
        for (int i = 0; i < n; i++) {
            pq.add(d[i]);
        }

        int divCount = n / 2;

        int value = 0;
        for (int i = 0; i < divCount; i++) {
            value = pq.poll();
        }

        int nextValue = pq.poll();

        int totalCount = nextValue - value;
        System.out.println(totalCount);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        int n = std.nextInt();
        int[] d = new int[n];
        for (int i = 0; i < n; i++) {
            d[i] = std.nextInt();
        }

        PriorityQueue<Integer> pq = new PriorityQueue<>(n);
        for (int i = 0; i < n; i++) {
            pq.add(d[i]);
        }

        int divCount = n / 2;

        int value = 0;
        for (int i = 0; i < divCount; i++) {
            value = pq.poll();
        }

        int nextValue = pq.poll();

        int totalCount = nextValue - value;
        System.out.println(totalCount);
    }
} Main
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        int n = std.nextInt();
        int[] d = new int[n];
        for (int i = 0; i < n; i++) {
            d[i] = std.nextInt();
        }

        PriorityQueue<Integer> pq = new PriorityQueue<>(n);
        for (int i = 0; i < n; i++) {
            pq.add(d[i]);
        }

        int divCount = n / 2;

        int value = 0;
        for (int i = 0; i < divCount; i++) {
            value = pq.poll();
        }

        int nextValue = pq.poll();

        int totalCount = nextValue - value;
        System.out.println(totalCount);
    }
}
