import java.util.Scanner;
import java.util.Arrays;

public class Main {

	public static void main (String[] args) {

		Scanner sc = new Scanner (System.in);
		
		int N = sc.nextInt();
		
		int [] list = new int [N];
		
		for (int index=0; index<N; index++){
		    list[index]= sc.nextInt();
		}
		
		Arrays.sort(list);
		
		int dif = list [N/2] - list [N/2-1];
		
		System.out.println(dif);

		sc.close();
	}
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main {

	public static void main (String[] args) {

		Scanner sc = new Scanner (System.in);
		
		int N = sc.nextInt();
		
		int [] list = new int [N];
		
		for (int index=0; index<N; index++){
		    list[index]= sc.nextInt();
		}
		
		Arrays.sort(list);
		
		int dif = list [N/2] - list [N/2-1];
		
		System.out.println(dif);

		sc.close();
	}
} Main public static void main (String[] args) {

		Scanner sc = new Scanner (System.in);
		
		int N = sc.nextInt();
		
		int [] list = new int [N];
		
		for (int index=0; index<N; index++){
		    list[index]= sc.nextInt();
		}
		
		Arrays.sort(list);
		
		int dif = list [N/2] - list [N/2-1];
		
		System.out.println(dif);

		sc.close();
	} main {

		Scanner sc = new Scanner (System.in);
		
		int N = sc.nextInt();
		
		int [] list = new int [N];
		
		for (int index=0; index<N; index++){
		    list[index]= sc.nextInt();
		}
		
		Arrays.sort(list);
		
		int dif = list [N/2] - list [N/2-1];
		
		System.out.println(dif);

		sc.close();
	} Scanner sc = new Scanner (System.in); sc new Scanner (System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int [] list = new int [N]; list new int [N] N for (int index=0; index<N; index++){
		    list[index]= sc.nextInt();
		} int index=0; int index=0; index 0 index<N index N index++ index++ index {
		    list[index]= sc.nextInt();
		} {
		    list[index]= sc.nextInt();
		} list[index]= sc.nextInt() list[index] list index sc.nextInt() sc.nextInt sc Arrays.sort(list) Arrays.sort Arrays list int dif = list [N/2] - list [N/2-1]; dif list [N/2] - list [N/2-1] list [N/2] list N/2 N 2 list [N/2-1] list N/2-1 N/2 N 2 1 System.out.println(dif) System.out.println System.out System System.out dif sc.close() sc.close sc String[] args args public class Main {

	public static void main (String[] args) {

		Scanner sc = new Scanner (System.in);
		
		int N = sc.nextInt();
		
		int [] list = new int [N];
		
		for (int index=0; index<N; index++){
		    list[index]= sc.nextInt();
		}
		
		Arrays.sort(list);
		
		int dif = list [N/2] - list [N/2-1];
		
		System.out.println(dif);

		sc.close();
	}
} public class Main {

	public static void main (String[] args) {

		Scanner sc = new Scanner (System.in);
		
		int N = sc.nextInt();
		
		int [] list = new int [N];
		
		for (int index=0; index<N; index++){
		    list[index]= sc.nextInt();
		}
		
		Arrays.sort(list);
		
		int dif = list [N/2] - list [N/2-1];
		
		System.out.println(dif);

		sc.close();
	}
} Main
import java.util.Scanner;
import java.util.Arrays;

public class Main {

	public static void main (String[] args) {

		Scanner sc = new Scanner (System.in);
		
		int N = sc.nextInt();
		
		int [] list = new int [N];
		
		for (int index=0; index<N; index++){
		    list[index]= sc.nextInt();
		}
		
		Arrays.sort(list);
		
		int dif = list [N/2] - list [N/2-1];
		
		System.out.println(dif);

		sc.close();
	}
}