import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] d = new int[n];
        for(int i = 0;i<n;i++){
            d[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(d);
        if(n == 2){
            System.out.println(d[1] - d[0]);
        }else{
            int a = d[d.length/2] - d[d.length/2 -1];
            if(d[d.length/2 -1] - d[d.length/2] == 0 && d[d.length/2-1] - d[d.length/2 -2] == 0){
                a -= 1;
            }
            if(a <= 0){
                System.out.println(0);
            }else{
                System.out.println(a);
            }
        }
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] d = new int[n];
        for(int i = 0;i<n;i++){
            d[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(d);
        if(n == 2){
            System.out.println(d[1] - d[0]);
        }else{
            int a = d[d.length/2] - d[d.length/2 -1];
            if(d[d.length/2 -1] - d[d.length/2] == 0 && d[d.length/2-1] - d[d.length/2 -2] == 0){
                a -= 1;
            }
            if(a <= 0){
                System.out.println(0);
            }else{
                System.out.println(a);
            }
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] d = new int[n];
        for(int i = 0;i<n;i++){
            d[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(d);
        if(n == 2){
            System.out.println(d[1] - d[0]);
        }else{
            int a = d[d.length/2] - d[d.length/2 -1];
            if(d[d.length/2 -1] - d[d.length/2] == 0 && d[d.length/2-1] - d[d.length/2 -2] == 0){
                a -= 1;
            }
            if(a <= 0){
                System.out.println(0);
            }else{
                System.out.println(a);
            }
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] d = new int[n];
        for(int i = 0;i<n;i++){
            d[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(d);
        if(n == 2){
            System.out.println(d[1] - d[0]);
        }else{
            int a = d[d.length/2] - d[d.length/2 -1];
            if(d[d.length/2 -1] - d[d.length/2] == 0 && d[d.length/2-1] - d[d.length/2 -2] == 0){
                a -= 1;
            }
            if(a <= 0){
                System.out.println(0);
            }else{
                System.out.println(a);
            }
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] d = new int[n]; d new int[n] n for(int i = 0;i<n;i++){
            d[i] = Integer.parseInt(sc.next());
        } int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
            d[i] = Integer.parseInt(sc.next());
        } {
            d[i] = Integer.parseInt(sc.next());
        } d[i] = Integer.parseInt(sc.next()) d[i] d i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc Arrays.sort(d) Arrays.sort Arrays d if(n == 2){
            System.out.println(d[1] - d[0]);
        }else{
            int a = d[d.length/2] - d[d.length/2 -1];
            if(d[d.length/2 -1] - d[d.length/2] == 0 && d[d.length/2-1] - d[d.length/2 -2] == 0){
                a -= 1;
            }
            if(a <= 0){
                System.out.println(0);
            }else{
                System.out.println(a);
            }
        } n == 2 n 2 {
            System.out.println(d[1] - d[0]);
        } System.out.println(d[1] - d[0]) System.out.println System.out System System.out d[1] - d[0] d[1] d 1 d[0] d 0 {
            int a = d[d.length/2] - d[d.length/2 -1];
            if(d[d.length/2 -1] - d[d.length/2] == 0 && d[d.length/2-1] - d[d.length/2 -2] == 0){
                a -= 1;
            }
            if(a <= 0){
                System.out.println(0);
            }else{
                System.out.println(a);
            }
        } int a = d[d.length/2] - d[d.length/2 -1]; a d[d.length/2] - d[d.length/2 -1] d[d.length/2] d d.length/2 d.length d d.length 2 d[d.length/2 -1] d d.length/2 -1 d.length/2 d.length d d.length 2 1 if(d[d.length/2 -1] - d[d.length/2] == 0 && d[d.length/2-1] - d[d.length/2 -2] == 0){
                a -= 1;
            } d[d.length/2 -1] - d[d.length/2] == 0 && d[d.length/2-1] - d[d.length/2 -2] == 0 d[d.length/2 -1] - d[d.length/2] == 0 d[d.length/2 -1] - d[d.length/2] d[d.length/2 -1] d d.length/2 -1 d.length/2 d.length d d.length 2 1 d[d.length/2] d d.length/2 d.length d d.length 2 0 d[d.length/2-1] - d[d.length/2 -2] == 0 d[d.length/2-1] - d[d.length/2 -2] d[d.length/2-1] d d.length/2-1 d.length/2 d.length d d.length 2 1 d[d.length/2 -2] d d.length/2 -2 d.length/2 d.length d d.length 2 2 0 {
                a -= 1;
            } a -= 1 a 1 if(a <= 0){
                System.out.println(0);
            }else{
                System.out.println(a);
            } a <= 0 a 0 {
                System.out.println(0);
            } System.out.println(0) System.out.println System.out System System.out 0 {
                System.out.println(a);
            } System.out.println(a) System.out.println System.out System System.out a String[] args args public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] d = new int[n];
        for(int i = 0;i<n;i++){
            d[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(d);
        if(n == 2){
            System.out.println(d[1] - d[0]);
        }else{
            int a = d[d.length/2] - d[d.length/2 -1];
            if(d[d.length/2 -1] - d[d.length/2] == 0 && d[d.length/2-1] - d[d.length/2 -2] == 0){
                a -= 1;
            }
            if(a <= 0){
                System.out.println(0);
            }else{
                System.out.println(a);
            }
        }
    }
} public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] d = new int[n];
        for(int i = 0;i<n;i++){
            d[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(d);
        if(n == 2){
            System.out.println(d[1] - d[0]);
        }else{
            int a = d[d.length/2] - d[d.length/2 -1];
            if(d[d.length/2 -1] - d[d.length/2] == 0 && d[d.length/2-1] - d[d.length/2 -2] == 0){
                a -= 1;
            }
            if(a <= 0){
                System.out.println(0);
            }else{
                System.out.println(a);
            }
        }
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] d = new int[n];
        for(int i = 0;i<n;i++){
            d[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(d);
        if(n == 2){
            System.out.println(d[1] - d[0]);
        }else{
            int a = d[d.length/2] - d[d.length/2 -1];
            if(d[d.length/2 -1] - d[d.length/2] == 0 && d[d.length/2-1] - d[d.length/2 -2] == 0){
                a -= 1;
            }
            if(a <= 0){
                System.out.println(0);
            }else{
                System.out.println(a);
            }
        }
    }
}