
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		@SuppressWarnings("resource")
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] d = new int[n];
		for (int i = 0; i < n; i++) {
			d[i] = scanner.nextInt();
		}
		Arrays.sort(d);
		int m = n / 2;
		System.out.println(d[m] - d[m - 1]);
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws Exception {
		@SuppressWarnings("resource")
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] d = new int[n];
		for (int i = 0; i < n; i++) {
			d[i] = scanner.nextInt();
		}
		Arrays.sort(d);
		int m = n / 2;
		System.out.println(d[m] - d[m - 1]);
	}
} Main public static void main(String[] args) throws Exception {
		@SuppressWarnings("resource")
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] d = new int[n];
		for (int i = 0; i < n; i++) {
			d[i] = scanner.nextInt();
		}
		Arrays.sort(d);
		int m = n / 2;
		System.out.println(d[m] - d[m - 1]);
	} main {
		@SuppressWarnings("resource")
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] d = new int[n];
		for (int i = 0; i < n; i++) {
			d[i] = scanner.nextInt();
		}
		Arrays.sort(d);
		int m = n / 2;
		System.out.println(d[m] - d[m - 1]);
	} @SuppressWarnings("resource")
		Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] d = new int[n]; d new int[n] n for (int i = 0; i < n; i++) {
			d[i] = scanner.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			d[i] = scanner.nextInt();
		} {
			d[i] = scanner.nextInt();
		} d[i] = scanner.nextInt() d[i] d i scanner.nextInt() scanner.nextInt scanner Arrays.sort(d) Arrays.sort Arrays d int m = n / 2; m n / 2 n 2 System.out.println(d[m] - d[m - 1]) System.out.println System.out System System.out d[m] - d[m - 1] d[m] d m d[m - 1] d m - 1 m 1 String[] args args public class Main {

	public static void main(String[] args) throws Exception {
		@SuppressWarnings("resource")
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] d = new int[n];
		for (int i = 0; i < n; i++) {
			d[i] = scanner.nextInt();
		}
		Arrays.sort(d);
		int m = n / 2;
		System.out.println(d[m] - d[m - 1]);
	}
} public class Main {

	public static void main(String[] args) throws Exception {
		@SuppressWarnings("resource")
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] d = new int[n];
		for (int i = 0; i < n; i++) {
			d[i] = scanner.nextInt();
		}
		Arrays.sort(d);
		int m = n / 2;
		System.out.println(d[m] - d[m - 1]);
	}
} Main

import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		@SuppressWarnings("resource")
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] d = new int[n];
		for (int i = 0; i < n; i++) {
			d[i] = scanner.nextInt();
		}
		Arrays.sort(d);
		int m = n / 2;
		System.out.println(d[m] - d[m - 1]);
	}
}
