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

 class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a= new int[n];
        for(int i=0;i<n;i++)
            a[i]=in.nextInt();
        Arrays.sort(a);
        int mid=a[n/2];
        int prev = a[n/2-1];
       // System.out.println(mid +" " + prev);
        if(mid==prev)
            System.out.println(0);
        else{
            int ans=mid-prev;
            System.out.println(ans);
        }
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a= new int[n];
        for(int i=0;i<n;i++)
            a[i]=in.nextInt();
        Arrays.sort(a);
        int mid=a[n/2];
        int prev = a[n/2-1];
       // System.out.println(mid +" " + prev);
        if(mid==prev)
            System.out.println(0);
        else{
            int ans=mid-prev;
            System.out.println(ans);
        }
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a= new int[n];
        for(int i=0;i<n;i++)
            a[i]=in.nextInt();
        Arrays.sort(a);
        int mid=a[n/2];
        int prev = a[n/2-1];
       // System.out.println(mid +" " + prev);
        if(mid==prev)
            System.out.println(0);
        else{
            int ans=mid-prev;
            System.out.println(ans);
        }
    } main {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a= new int[n];
        for(int i=0;i<n;i++)
            a[i]=in.nextInt();
        Arrays.sort(a);
        int mid=a[n/2];
        int prev = a[n/2-1];
       // System.out.println(mid +" " + prev);
        if(mid==prev)
            System.out.println(0);
        else{
            int ans=mid-prev;
            System.out.println(ans);
        }
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int[] a= new int[n]; a new int[n] n for(int i=0;i<n;i++)
            a[i]=in.nextInt(); int i=0; int i=0; i 0 i<n i n i++ i++ i a[i]=in.nextInt(); a[i]=in.nextInt() a[i] a i in.nextInt() in.nextInt in Arrays.sort(a) Arrays.sort Arrays a int mid=a[n/2]; mid a[n/2] a n/2 n 2 int prev = a[n/2-1]; prev a[n/2-1] a n/2-1 n/2 n 2 1 if(mid==prev)
            System.out.println(0);
        else{
            int ans=mid-prev;
            System.out.println(ans);
        } mid==prev mid prev System.out.println(0) System.out.println System.out System System.out 0 {
            int ans=mid-prev;
            System.out.println(ans);
        } int ans=mid-prev; ans mid-prev mid prev System.out.println(ans) System.out.println System.out System System.out ans String[] args args

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

 class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a= new int[n];
        for(int i=0;i<n;i++)
            a[i]=in.nextInt();
        Arrays.sort(a);
        int mid=a[n/2];
        int prev = a[n/2-1];
       // System.out.println(mid +" " + prev);
        if(mid==prev)
            System.out.println(0);
        else{
            int ans=mid-prev;
            System.out.println(ans);
        }
    }
}
