import java.util.*;

public class Main{
	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] X = new int[N];
		for(int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
		}
		Arrays.sort(X);
		int min = X[N / 2 - 1];
		int max = X[N / 2];
		
		System.out.println(max-min);
	}
} import java.util.*; util.* java public class Main{
	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] X = new int[N];
		for(int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
		}
		Arrays.sort(X);
		int min = X[N / 2 - 1];
		int max = X[N / 2];
		
		System.out.println(max-min);
	}
} Main public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] X = new int[N];
		for(int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
		}
		Arrays.sort(X);
		int min = X[N / 2 - 1];
		int max = X[N / 2];
		
		System.out.println(max-min);
	} main {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] X = new int[N];
		for(int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
		}
		Arrays.sort(X);
		int min = X[N / 2 - 1];
		int max = X[N / 2];
		
		System.out.println(max-min);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] X = new int[N]; X new int[N] N for(int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			X[i] = sc.nextInt();
		} {
			X[i] = sc.nextInt();
		} X[i] = sc.nextInt() X[i] X i sc.nextInt() sc.nextInt sc Arrays.sort(X) Arrays.sort Arrays X int min = X[N / 2 - 1]; min X[N / 2 - 1] X N / 2 - 1 N / 2 N 2 1 int max = X[N / 2]; max X[N / 2] X N / 2 N 2 System.out.println(max-min) System.out.println System.out System System.out max-min max min String args[] args public class Main{
	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] X = new int[N];
		for(int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
		}
		Arrays.sort(X);
		int min = X[N / 2 - 1];
		int max = X[N / 2];
		
		System.out.println(max-min);
	}
} public class Main{
	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] X = new int[N];
		for(int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
		}
		Arrays.sort(X);
		int min = X[N / 2 - 1];
		int max = X[N / 2];
		
		System.out.println(max-min);
	}
} Main
import java.util.*;

public class Main{
	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] X = new int[N];
		for(int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
		}
		Arrays.sort(X);
		int min = X[N / 2 - 1];
		int max = X[N / 2];
		
		System.out.println(max-min);
	}
}