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

public class Main {

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

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

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

} public class Main {

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

} Main

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

public class Main {

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

}
