import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> d = new ArrayList<Integer>();
		for(int i = 0; i < n; i++) {
			d.add(sc.nextInt());
		}
		sc.close();
		Collections.sort(d);
		int ans = d.get(n/2) - d.get(n/2-1);
		System.out.println(ans);
	}

} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections 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();
		ArrayList<Integer> d = new ArrayList<Integer>();
		for(int i = 0; i < n; i++) {
			d.add(sc.nextInt());
		}
		sc.close();
		Collections.sort(d);
		int ans = d.get(n/2) - d.get(n/2-1);
		System.out.println(ans);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> d = new ArrayList<Integer>();
		for(int i = 0; i < n; i++) {
			d.add(sc.nextInt());
		}
		sc.close();
		Collections.sort(d);
		int ans = d.get(n/2) - d.get(n/2-1);
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> d = new ArrayList<Integer>();
		for(int i = 0; i < n; i++) {
			d.add(sc.nextInt());
		}
		sc.close();
		Collections.sort(d);
		int ans = d.get(n/2) - d.get(n/2-1);
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc ArrayList<Integer> d = new ArrayList<Integer>(); d new ArrayList<Integer>() for(int i = 0; i < n; i++) {
			d.add(sc.nextInt());
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			d.add(sc.nextInt());
		} {
			d.add(sc.nextInt());
		} d.add(sc.nextInt()) d.add d sc.nextInt() sc.nextInt sc sc.close() sc.close sc Collections.sort(d) Collections.sort Collections d int ans = d.get(n/2) - d.get(n/2-1); ans d.get(n/2) - d.get(n/2-1) d.get(n/2) d.get d n/2 n 2 d.get(n/2-1) d.get d n/2-1 n/2 n 2 1 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 sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> d = new ArrayList<Integer>();
		for(int i = 0; i < n; i++) {
			d.add(sc.nextInt());
		}
		sc.close();
		Collections.sort(d);
		int ans = d.get(n/2) - d.get(n/2-1);
		System.out.println(ans);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> d = new ArrayList<Integer>();
		for(int i = 0; i < n; i++) {
			d.add(sc.nextInt());
		}
		sc.close();
		Collections.sort(d);
		int ans = d.get(n/2) - d.get(n/2-1);
		System.out.println(ans);
	}

} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> d = new ArrayList<Integer>();
		for(int i = 0; i < n; i++) {
			d.add(sc.nextInt());
		}
		sc.close();
		Collections.sort(d);
		int ans = d.get(n/2) - d.get(n/2-1);
		System.out.println(ans);
	}

}
