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 = Integer.parseInt(sc.next());
		int[] d = new int[N];
		for(int i = 0; i < N; i++) {
			d[i] = sc.nextInt();
		}
		sc.close();
		
		Arrays.sort(d);
		int result = d[N/2] - d[N/2 - 1];
		System.out.println(result);
	}
} 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 = Integer.parseInt(sc.next());
		int[] d = new int[N];
		for(int i = 0; i < N; i++) {
			d[i] = sc.nextInt();
		}
		sc.close();
		
		Arrays.sort(d);
		int result = d[N/2] - d[N/2 - 1];
		System.out.println(result);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int[] d = new int[N];
		for(int i = 0; i < N; i++) {
			d[i] = sc.nextInt();
		}
		sc.close();
		
		Arrays.sort(d);
		int result = d[N/2] - d[N/2 - 1];
		System.out.println(result);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int[] d = new int[N];
		for(int i = 0; i < N; i++) {
			d[i] = sc.nextInt();
		}
		sc.close();
		
		Arrays.sort(d);
		int result = d[N/2] - d[N/2 - 1];
		System.out.println(result);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] d = new int[N]; d new int[N] N for(int i = 0; i < N; i++) {
			d[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			d[i] = sc.nextInt();
		} {
			d[i] = sc.nextInt();
		} d[i] = sc.nextInt() d[i] d i sc.nextInt() sc.nextInt sc sc.close() sc.close sc Arrays.sort(d) Arrays.sort Arrays d int result = d[N/2] - d[N/2 - 1]; result d[N/2] - d[N/2 - 1] d[N/2] d N/2 N 2 d[N/2 - 1] d N/2 - 1 N/2 N 2 1 System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int[] d = new int[N];
		for(int i = 0; i < N; i++) {
			d[i] = sc.nextInt();
		}
		sc.close();
		
		Arrays.sort(d);
		int result = d[N/2] - d[N/2 - 1];
		System.out.println(result);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int[] d = new int[N];
		for(int i = 0; i < N; i++) {
			d[i] = sc.nextInt();
		}
		sc.close();
		
		Arrays.sort(d);
		int result = d[N/2] - d[N/2 - 1];
		System.out.println(result);
	}
} 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 = Integer.parseInt(sc.next());
		int[] d = new int[N];
		for(int i = 0; i < N; i++) {
			d[i] = sc.nextInt();
		}
		sc.close();
		
		Arrays.sort(d);
		int result = d[N/2] - d[N/2 - 1];
		System.out.println(result);
	}
}