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];
    
    for(int i = 0 ; i < N ; i ++){
      array[i] = sc.nextInt();
    }
    
    Arrays.sort(array);
    
    int ans = array[N/2] -array[N/2 -1];
    
    System.out.println(ans);
  }
} 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];
    
    for(int i = 0 ; i < N ; i ++){
      array[i] = sc.nextInt();
    }
    
    Arrays.sort(array);
    
    int ans = array[N/2] -array[N/2 -1];
    
    System.out.println(ans);
  }
} Main public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] array = new int[N];
    
    for(int i = 0 ; i < N ; i ++){
      array[i] = sc.nextInt();
    }
    
    Arrays.sort(array);
    
    int ans = array[N/2] -array[N/2 -1];
    
    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] array = new int[N];
    
    for(int i = 0 ; i < N ; i ++){
      array[i] = sc.nextInt();
    }
    
    Arrays.sort(array);
    
    int ans = array[N/2] -array[N/2 -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 int[] array = new int[N]; array new int[N] N 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 ans = array[N/2] -array[N/2 -1]; ans array[N/2] -array[N/2 -1] array[N/2] array N/2 N 2 array[N/2 -1] array N/2 -1 N/2 N 2 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 ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] array = new int[N];
    
    for(int i = 0 ; i < N ; i ++){
      array[i] = sc.nextInt();
    }
    
    Arrays.sort(array);
    
    int ans = array[N/2] -array[N/2 -1];
    
    System.out.println(ans);
  }
} 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];
    
    for(int i = 0 ; i < N ; i ++){
      array[i] = sc.nextInt();
    }
    
    Arrays.sort(array);
    
    int ans = array[N/2] -array[N/2 -1];
    
    System.out.println(ans);
  }
} 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];
    
    for(int i = 0 ; i < N ; i ++){
      array[i] = sc.nextInt();
    }
    
    Arrays.sort(array);
    
    int ans = array[N/2] -array[N/2 -1];
    
    System.out.println(ans);
  }
}