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

 class Main{
 
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner scan = new Scanner(System.in) ;
        int n = scan.nextInt();
        int arr[] = new int[n];
        for(int i = 0 ; i <n ;i++){
            arr[i]=scan.nextInt();
        }
        Arrays.sort(arr);
        int x = arr[n/2] - arr[n/2 -1] ;
        System.out.println(x);
    }
    
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util class Main{
 
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner scan = new Scanner(System.in) ;
        int n = scan.nextInt();
        int arr[] = new int[n];
        for(int i = 0 ; i <n ;i++){
            arr[i]=scan.nextInt();
        }
        Arrays.sort(arr);
        int x = arr[n/2] - arr[n/2 -1] ;
        System.out.println(x);
    }
    
} Main public static void main(String[] args) {
        // TODO code application logic here
        Scanner scan = new Scanner(System.in) ;
        int n = scan.nextInt();
        int arr[] = new int[n];
        for(int i = 0 ; i <n ;i++){
            arr[i]=scan.nextInt();
        }
        Arrays.sort(arr);
        int x = arr[n/2] - arr[n/2 -1] ;
        System.out.println(x);
    } main {
        // TODO code application logic here
        Scanner scan = new Scanner(System.in) ;
        int n = scan.nextInt();
        int arr[] = new int[n];
        for(int i = 0 ; i <n ;i++){
            arr[i]=scan.nextInt();
        }
        Arrays.sort(arr);
        int x = arr[n/2] - arr[n/2 -1] ;
        System.out.println(x);
    } Scanner scan = new Scanner(System.in) ; scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int arr[] = new int[n]; arr new int[n] n for(int i = 0 ; i <n ;i++){
            arr[i]=scan.nextInt();
        } int i = 0 ; int i = 0 ; i 0 i <n i n i++ i++ i {
            arr[i]=scan.nextInt();
        } {
            arr[i]=scan.nextInt();
        } arr[i]=scan.nextInt() arr[i] arr i scan.nextInt() scan.nextInt scan Arrays.sort(arr) Arrays.sort Arrays arr int x = arr[n/2] - arr[n/2 -1] ; x arr[n/2] - arr[n/2 -1] arr[n/2] arr n/2 n 2 arr[n/2 -1] arr n/2 -1 n/2 n 2 1 System.out.println(x) System.out.println System.out System System.out x String[] args args
 
 
import java.util.Arrays;
import java.util.Scanner;

 class Main{
 
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner scan = new Scanner(System.in) ;
        int n = scan.nextInt();
        int arr[] = new int[n];
        for(int i = 0 ; i <n ;i++){
            arr[i]=scan.nextInt();
        }
        Arrays.sort(arr);
        int x = arr[n/2] - arr[n/2 -1] ;
        System.out.println(x);
    }
    
}
