import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        int[] d = new int[n];
        for(int i = 0; i < n; i ++) d[i] = sc.nextInt();
        Arrays.sort(d);
        
        int arc_min = d[n/2];
        int abc_max = d[n/2-1];
        
        // K = abc_max+1, ... , arc_min
        int ans = arc_min - abc_max;
        System.out.println(ans);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        int[] d = new int[n];
        for(int i = 0; i < n; i ++) d[i] = sc.nextInt();
        Arrays.sort(d);
        
        int arc_min = d[n/2];
        int abc_max = d[n/2-1];
        
        // K = abc_max+1, ... , arc_min
        int ans = arc_min - abc_max;
        System.out.println(ans);
    }
} Main public static void main(String[] args) throws Exception {
        // Your code here!
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        int[] d = new int[n];
        for(int i = 0; i < n; i ++) d[i] = sc.nextInt();
        Arrays.sort(d);
        
        int arc_min = d[n/2];
        int abc_max = d[n/2-1];
        
        // K = abc_max+1, ... , arc_min
        int ans = arc_min - abc_max;
        System.out.println(ans);
    } main {
        // Your code here!
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        int[] d = new int[n];
        for(int i = 0; i < n; i ++) d[i] = sc.nextInt();
        Arrays.sort(d);
        
        int arc_min = d[n/2];
        int abc_max = d[n/2-1];
        
        // K = abc_max+1, ... , arc_min
        int ans = arc_min - abc_max;
        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[] d = new int[n]; d new int[n] n for(int i = 0; i < n; i ++) d[i] = sc.nextInt(); int i = 0; int i = 0; i 0 i < n i n i ++ i ++ i d[i] = sc.nextInt(); d[i] = sc.nextInt() d[i] d i sc.nextInt() sc.nextInt sc Arrays.sort(d) Arrays.sort Arrays d int arc_min = d[n/2]; arc_min d[n/2] d n/2 n 2 int abc_max = d[n/2-1]; abc_max d[n/2-1] d n/2-1 n/2 n 2 1 int ans = arc_min - abc_max; ans arc_min - abc_max arc_min abc_max 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 {
        // Your code here!
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        int[] d = new int[n];
        for(int i = 0; i < n; i ++) d[i] = sc.nextInt();
        Arrays.sort(d);
        
        int arc_min = d[n/2];
        int abc_max = d[n/2-1];
        
        // K = abc_max+1, ... , arc_min
        int ans = arc_min - abc_max;
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        int[] d = new int[n];
        for(int i = 0; i < n; i ++) d[i] = sc.nextInt();
        Arrays.sort(d);
        
        int arc_min = d[n/2];
        int abc_max = d[n/2-1];
        
        // K = abc_max+1, ... , arc_min
        int ans = arc_min - abc_max;
        System.out.println(ans);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        int[] d = new int[n];
        for(int i = 0; i < n; i ++) d[i] = sc.nextInt();
        Arrays.sort(d);
        
        int arc_min = d[n/2];
        int abc_max = d[n/2-1];
        
        // K = abc_max+1, ... , arc_min
        int ans = arc_min - abc_max;
        System.out.println(ans);
    }
}