import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		PriorityQueue<Integer> list = new PriorityQueue<>();
		int n = sc.nextInt();
		
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		int size = list.size();
		
		int prev = 0;
		for (int i = 0; i < size / 2; i++) {
			prev = list.poll();
		}
		System.out.println(list.peek()-prev);
		
	}

} import java.util.PriorityQueue; PriorityQueue java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		PriorityQueue<Integer> list = new PriorityQueue<>();
		int n = sc.nextInt();
		
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		int size = list.size();
		
		int prev = 0;
		for (int i = 0; i < size / 2; i++) {
			prev = list.poll();
		}
		System.out.println(list.peek()-prev);
		
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		PriorityQueue<Integer> list = new PriorityQueue<>();
		int n = sc.nextInt();
		
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		int size = list.size();
		
		int prev = 0;
		for (int i = 0; i < size / 2; i++) {
			prev = list.poll();
		}
		System.out.println(list.peek()-prev);
		
	} main {
		Scanner sc = new Scanner(System.in);
		
		PriorityQueue<Integer> list = new PriorityQueue<>();
		int n = sc.nextInt();
		
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		int size = list.size();
		
		int prev = 0;
		for (int i = 0; i < size / 2; i++) {
			prev = list.poll();
		}
		System.out.println(list.peek()-prev);
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) PriorityQueue<Integer> list = new PriorityQueue<>(); list new PriorityQueue<>() int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc 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 int size = list.size(); size list.size() list.size list int prev = 0; prev 0 for (int i = 0; i < size / 2; i++) {
			prev = list.poll();
		} int i = 0; int i = 0; i 0 i < size / 2 i size / 2 size 2 i++ i++ i {
			prev = list.poll();
		} {
			prev = list.poll();
		} prev = list.poll() prev list.poll() list.poll list System.out.println(list.peek()-prev) System.out.println System.out System System.out list.peek()-prev list.peek() list.peek list prev String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		PriorityQueue<Integer> list = new PriorityQueue<>();
		int n = sc.nextInt();
		
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		int size = list.size();
		
		int prev = 0;
		for (int i = 0; i < size / 2; i++) {
			prev = list.poll();
		}
		System.out.println(list.peek()-prev);
		
	}

} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		PriorityQueue<Integer> list = new PriorityQueue<>();
		int n = sc.nextInt();
		
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		int size = list.size();
		
		int prev = 0;
		for (int i = 0; i < size / 2; i++) {
			prev = list.poll();
		}
		System.out.println(list.peek()-prev);
		
	}

} Main
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		PriorityQueue<Integer> list = new PriorityQueue<>();
		int n = sc.nextInt();
		
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		int size = list.size();
		
		int prev = 0;
		for (int i = 0; i < size / 2; i++) {
			prev = list.poll();
		}
		System.out.println(list.peek()-prev);
		
	}

}
