import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int[] b = new int[a];
		int c;
		int d = a/2;
		int Answer = 0;
		for(int i = 0; a>i; i++) {
			c = sc.nextInt();
			b[i] = c;
		}
		Arrays.sort(b);
		int f = b[d];
		int g = b[d-1];
		Answer = f-g;
		System.out.println(Answer);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int[] b = new int[a];
		int c;
		int d = a/2;
		int Answer = 0;
		for(int i = 0; a>i; i++) {
			c = sc.nextInt();
			b[i] = c;
		}
		Arrays.sort(b);
		int f = b[d];
		int g = b[d-1];
		Answer = f-g;
		System.out.println(Answer);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int[] b = new int[a];
		int c;
		int d = a/2;
		int Answer = 0;
		for(int i = 0; a>i; i++) {
			c = sc.nextInt();
			b[i] = c;
		}
		Arrays.sort(b);
		int f = b[d];
		int g = b[d-1];
		Answer = f-g;
		System.out.println(Answer);
	} main {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int[] b = new int[a];
		int c;
		int d = a/2;
		int Answer = 0;
		for(int i = 0; a>i; i++) {
			c = sc.nextInt();
			b[i] = c;
		}
		Arrays.sort(b);
		int f = b[d];
		int g = b[d-1];
		Answer = f-g;
		System.out.println(Answer);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int[] b = new int[a]; b new int[a] a int c; c int d = a/2; d a/2 a 2 int Answer = 0; Answer 0 for(int i = 0; a>i; i++) {
			c = sc.nextInt();
			b[i] = c;
		} int i = 0; int i = 0; i 0 a>i a i i++ i++ i {
			c = sc.nextInt();
			b[i] = c;
		} {
			c = sc.nextInt();
			b[i] = c;
		} c = sc.nextInt() c sc.nextInt() sc.nextInt sc b[i] = c b[i] b i c Arrays.sort(b) Arrays.sort Arrays b int f = b[d]; f b[d] b d int g = b[d-1]; g b[d-1] b d-1 d 1 Answer = f-g Answer f-g f g System.out.println(Answer) System.out.println System.out System System.out Answer String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int[] b = new int[a];
		int c;
		int d = a/2;
		int Answer = 0;
		for(int i = 0; a>i; i++) {
			c = sc.nextInt();
			b[i] = c;
		}
		Arrays.sort(b);
		int f = b[d];
		int g = b[d-1];
		Answer = f-g;
		System.out.println(Answer);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int[] b = new int[a];
		int c;
		int d = a/2;
		int Answer = 0;
		for(int i = 0; a>i; i++) {
			c = sc.nextInt();
			b[i] = c;
		}
		Arrays.sort(b);
		int f = b[d];
		int g = b[d-1];
		Answer = f-g;
		System.out.println(Answer);
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int[] b = new int[a];
		int c;
		int d = a/2;
		int Answer = 0;
		for(int i = 0; a>i; i++) {
			c = sc.nextInt();
			b[i] = c;
		}
		Arrays.sort(b);
		int f = b[d];
		int g = b[d-1];
		Answer = f-g;
		System.out.println(Answer);
	}
}