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

public class Main {

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

		int[] d = new int[n];
		for (int i = 0; i < d.length; i++) {
			d[i] = sc.nextInt();
		}

		Arrays.sort(d);

//		for (int i = 0; i < d.length; i++) {
//			int j = d[i];
//			System.out.println(j);
//		}

		int div = n / 2;
		int a = d[div - 1];
		int b = d[div];

//		System.out.println(a + " " + b);
		if ( a != b) {
			k = b - a;
		}



		System.out.println(k);

	}

} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

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

		int[] d = new int[n];
		for (int i = 0; i < d.length; i++) {
			d[i] = sc.nextInt();
		}

		Arrays.sort(d);

//		for (int i = 0; i < d.length; i++) {
//			int j = d[i];
//			System.out.println(j);
//		}

		int div = n / 2;
		int a = d[div - 1];
		int b = d[div];

//		System.out.println(a + " " + b);
		if ( a != b) {
			k = b - a;
		}



		System.out.println(k);

	}

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

		int[] d = new int[n];
		for (int i = 0; i < d.length; i++) {
			d[i] = sc.nextInt();
		}

		Arrays.sort(d);

//		for (int i = 0; i < d.length; i++) {
//			int j = d[i];
//			System.out.println(j);
//		}

		int div = n / 2;
		int a = d[div - 1];
		int b = d[div];

//		System.out.println(a + " " + b);
		if ( a != b) {
			k = b - a;
		}



		System.out.println(k);

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

		int[] d = new int[n];
		for (int i = 0; i < d.length; i++) {
			d[i] = sc.nextInt();
		}

		Arrays.sort(d);

//		for (int i = 0; i < d.length; i++) {
//			int j = d[i];
//			System.out.println(j);
//		}

		int div = n / 2;
		int a = d[div - 1];
		int b = d[div];

//		System.out.println(a + " " + b);
		if ( a != b) {
			k = b - a;
		}



		System.out.println(k);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int k = 0; k 0 int[] d = new int[n]; d new int[n] n for (int i = 0; i < d.length; i++) {
			d[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < d.length i d.length d d.length i++ i++ i {
			d[i] = sc.nextInt();
		} {
			d[i] = sc.nextInt();
		} d[i] = sc.nextInt() d[i] d i sc.nextInt() sc.nextInt sc Arrays.sort(d) Arrays.sort Arrays d int div = n / 2; div n / 2 n 2 int a = d[div - 1]; a d[div - 1] d div - 1 div 1 int b = d[div]; b d[div] d div if ( a != b) {
			k = b - a;
		} a != b a b {
			k = b - a;
		} k = b - a k b - a b a System.out.println(k) System.out.println System.out System System.out k String[] args args public class Main {

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

		int[] d = new int[n];
		for (int i = 0; i < d.length; i++) {
			d[i] = sc.nextInt();
		}

		Arrays.sort(d);

//		for (int i = 0; i < d.length; i++) {
//			int j = d[i];
//			System.out.println(j);
//		}

		int div = n / 2;
		int a = d[div - 1];
		int b = d[div];

//		System.out.println(a + " " + b);
		if ( a != b) {
			k = b - a;
		}



		System.out.println(k);

	}

} public class Main {

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

		int[] d = new int[n];
		for (int i = 0; i < d.length; i++) {
			d[i] = sc.nextInt();
		}

		Arrays.sort(d);

//		for (int i = 0; i < d.length; i++) {
//			int j = d[i];
//			System.out.println(j);
//		}

		int div = n / 2;
		int a = d[div - 1];
		int b = d[div];

//		System.out.println(a + " " + b);
		if ( a != b) {
			k = b - a;
		}



		System.out.println(k);

	}

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

public class Main {

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

		int[] d = new int[n];
		for (int i = 0; i < d.length; i++) {
			d[i] = sc.nextInt();
		}

		Arrays.sort(d);

//		for (int i = 0; i < d.length; i++) {
//			int j = d[i];
//			System.out.println(j);
//		}

		int div = n / 2;
		int a = d[div - 1];
		int b = d[div];

//		System.out.println(a + " " + b);
		if ( a != b) {
			k = b - a;
		}



		System.out.println(k);

	}

}
