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[] dif = new int[n];
		int max = 0;
		for(int i = 0; i < n; i++){
			dif[i] = sc.nextInt();
		}
		Arrays.sort(dif);
		
		int res= dif[dif.length/2] - dif[dif.length/2 - 1];
		System.out.println(res);
	}
} 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[] dif = new int[n];
		int max = 0;
		for(int i = 0; i < n; i++){
			dif[i] = sc.nextInt();
		}
		Arrays.sort(dif);
		
		int res= dif[dif.length/2] - dif[dif.length/2 - 1];
		System.out.println(res);
	}
} Main public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] dif = new int[n];
		int max = 0;
		for(int i = 0; i < n; i++){
			dif[i] = sc.nextInt();
		}
		Arrays.sort(dif);
		
		int res= dif[dif.length/2] - dif[dif.length/2 - 1];
		System.out.println(res);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] dif = new int[n];
		int max = 0;
		for(int i = 0; i < n; i++){
			dif[i] = sc.nextInt();
		}
		Arrays.sort(dif);
		
		int res= dif[dif.length/2] - dif[dif.length/2 - 1];
		System.out.println(res);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] dif = new int[n]; dif new int[n] n int max = 0; max 0 for(int i = 0; i < n; i++){
			dif[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			dif[i] = sc.nextInt();
		} {
			dif[i] = sc.nextInt();
		} dif[i] = sc.nextInt() dif[i] dif i sc.nextInt() sc.nextInt sc Arrays.sort(dif) Arrays.sort Arrays dif int res= dif[dif.length/2] - dif[dif.length/2 - 1]; res dif[dif.length/2] - dif[dif.length/2 - 1] dif[dif.length/2] dif dif.length/2 dif.length dif dif.length 2 dif[dif.length/2 - 1] dif dif.length/2 - 1 dif.length/2 dif.length dif dif.length 2 1 System.out.println(res) System.out.println System.out System System.out res String[]args args public class Main {
	public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] dif = new int[n];
		int max = 0;
		for(int i = 0; i < n; i++){
			dif[i] = sc.nextInt();
		}
		Arrays.sort(dif);
		
		int res= dif[dif.length/2] - dif[dif.length/2 - 1];
		System.out.println(res);
	}
} public class Main {
	public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] dif = new int[n];
		int max = 0;
		for(int i = 0; i < n; i++){
			dif[i] = sc.nextInt();
		}
		Arrays.sort(dif);
		
		int res= dif[dif.length/2] - dif[dif.length/2 - 1];
		System.out.println(res);
	}
} 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[] dif = new int[n];
		int max = 0;
		for(int i = 0; i < n; i++){
			dif[i] = sc.nextInt();
		}
		Arrays.sort(dif);
		
		int res= dif[dif.length/2] - dif[dif.length/2 - 1];
		System.out.println(res);
	}
}