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

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int[] d = new int[N];
		for(int i = 0;i < N;i++) {
			d[i] = scn.nextInt();
		}
		Arrays.sort(d);
		int dd = d[N/2-1];
		int du = d[N/2];
		int ans = 0;
		if(dd!=du) {
			ans = du-dd;
		}
		System.out.println(ans);
	}

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

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int[] d = new int[N];
		for(int i = 0;i < N;i++) {
			d[i] = scn.nextInt();
		}
		Arrays.sort(d);
		int dd = d[N/2-1];
		int du = d[N/2];
		int ans = 0;
		if(dd!=du) {
			ans = du-dd;
		}
		System.out.println(ans);
	}

} Main public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int[] d = new int[N];
		for(int i = 0;i < N;i++) {
			d[i] = scn.nextInt();
		}
		Arrays.sort(d);
		int dd = d[N/2-1];
		int du = d[N/2];
		int ans = 0;
		if(dd!=du) {
			ans = du-dd;
		}
		System.out.println(ans);
	} main {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int[] d = new int[N];
		for(int i = 0;i < N;i++) {
			d[i] = scn.nextInt();
		}
		Arrays.sort(d);
		int dd = d[N/2-1];
		int du = d[N/2];
		int ans = 0;
		if(dd!=du) {
			ans = du-dd;
		}
		System.out.println(ans);
	} Scanner scn = new Scanner(System.in); scn new Scanner(System.in) int N = scn.nextInt(); N scn.nextInt() scn.nextInt scn int[] d = new int[N]; d new int[N] N for(int i = 0;i < N;i++) {
			d[i] = scn.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			d[i] = scn.nextInt();
		} {
			d[i] = scn.nextInt();
		} d[i] = scn.nextInt() d[i] d i scn.nextInt() scn.nextInt scn Arrays.sort(d) Arrays.sort Arrays d int dd = d[N/2-1]; dd d[N/2-1] d N/2-1 N/2 N 2 1 int du = d[N/2]; du d[N/2] d N/2 N 2 int ans = 0; ans 0 if(dd!=du) {
			ans = du-dd;
		} dd!=du dd du {
			ans = du-dd;
		} ans = du-dd ans du-dd du dd System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int[] d = new int[N];
		for(int i = 0;i < N;i++) {
			d[i] = scn.nextInt();
		}
		Arrays.sort(d);
		int dd = d[N/2-1];
		int du = d[N/2];
		int ans = 0;
		if(dd!=du) {
			ans = du-dd;
		}
		System.out.println(ans);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int[] d = new int[N];
		for(int i = 0;i < N;i++) {
			d[i] = scn.nextInt();
		}
		Arrays.sort(d);
		int dd = d[N/2-1];
		int du = d[N/2];
		int ans = 0;
		if(dd!=du) {
			ans = du-dd;
		}
		System.out.println(ans);
	}

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

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int[] d = new int[N];
		for(int i = 0;i < N;i++) {
			d[i] = scn.nextInt();
		}
		Arrays.sort(d);
		int dd = d[N/2-1];
		int du = d[N/2];
		int ans = 0;
		if(dd!=du) {
			ans = du-dd;
		}
		System.out.println(ans);
	}

}
