import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] array = new int[n];
        int count = 0;
        
        //初期化
        for(int i = 0; i < n; i++){
		    array[i] = sc.nextInt();
		}
		
		Arrays.sort(array);
		
		int m = n/2;
		System.out.println(array[m]-array[m-1]);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] array = new int[n];
        int count = 0;
        
        //初期化
        for(int i = 0; i < n; i++){
		    array[i] = sc.nextInt();
		}
		
		Arrays.sort(array);
		
		int m = n/2;
		System.out.println(array[m]-array[m-1]);
    }
} Main public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] array = new int[n];
        int count = 0;
        
        //初期化
        for(int i = 0; i < n; i++){
		    array[i] = sc.nextInt();
		}
		
		Arrays.sort(array);
		
		int m = n/2;
		System.out.println(array[m]-array[m-1]);
    } main {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] array = new int[n];
        int count = 0;
        
        //初期化
        for(int i = 0; i < n; i++){
		    array[i] = sc.nextInt();
		}
		
		Arrays.sort(array);
		
		int m = n/2;
		System.out.println(array[m]-array[m-1]);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] array = new int[n]; array new int[n] n int count = 0; count 0 for(int i = 0; i < n; i++){
		    array[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
		    array[i] = sc.nextInt();
		} {
		    array[i] = sc.nextInt();
		} array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc Arrays.sort(array) Arrays.sort Arrays array int m = n/2; m n/2 n 2 System.out.println(array[m]-array[m-1]) System.out.println System.out System System.out array[m]-array[m-1] array[m] array m array[m-1] array m-1 m 1 String[] args args public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] array = new int[n];
        int count = 0;
        
        //初期化
        for(int i = 0; i < n; i++){
		    array[i] = sc.nextInt();
		}
		
		Arrays.sort(array);
		
		int m = n/2;
		System.out.println(array[m]-array[m-1]);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] array = new int[n];
        int count = 0;
        
        //初期化
        for(int i = 0; i < n; i++){
		    array[i] = sc.nextInt();
		}
		
		Arrays.sort(array);
		
		int m = n/2;
		System.out.println(array[m]-array[m-1]);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] array = new int[n];
        int count = 0;
        
        //初期化
        for(int i = 0; i < n; i++){
		    array[i] = sc.nextInt();
		}
		
		Arrays.sort(array);
		
		int m = n/2;
		System.out.println(array[m]-array[m-1]);
    }
}