import java.util.*;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		ArrayList<Integer> d = new ArrayList<>();
		for(int i=0; i<n; i++) {
			d.add(sc.nextInt());
		}
		Collections.sort(d);
		int m1 = d.get(d.size()/2);
		int m2 = d.get(d.size()/2-1);
		System.out.println(m1-m2);
		sc.close();
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

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

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

public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		ArrayList<Integer> d = new ArrayList<>();
		for(int i=0; i<n; i++) {
			d.add(sc.nextInt());
		}
		Collections.sort(d);
		int m1 = d.get(d.size()/2);
		int m2 = d.get(d.size()/2-1);
		System.out.println(m1-m2);
		sc.close();
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		ArrayList<Integer> d = new ArrayList<>();
		for(int i=0; i<n; i++) {
			d.add(sc.nextInt());
		}
		Collections.sort(d);
		int m1 = d.get(d.size()/2);
		int m2 = d.get(d.size()/2-1);
		System.out.println(m1-m2);
		sc.close();
	}
}
