import java.util.Arrays;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
	    int n = scan.nextInt();
	    int d[]= new int[n];
	    for(int i=0;i<n;i++) {
	    	d[i]=scan.nextInt();
	    }
	    scan.close();

	    Arrays.sort(d);

	    int ans = d[n/2] - d[n/2-1];

	    System.out.println(ans);

	}

} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
	    int n = scan.nextInt();
	    int d[]= new int[n];
	    for(int i=0;i<n;i++) {
	    	d[i]=scan.nextInt();
	    }
	    scan.close();

	    Arrays.sort(d);

	    int ans = d[n/2] - d[n/2-1];

	    System.out.println(ans);

	}

} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
	    int n = scan.nextInt();
	    int d[]= new int[n];
	    for(int i=0;i<n;i++) {
	    	d[i]=scan.nextInt();
	    }
	    scan.close();

	    Arrays.sort(d);

	    int ans = d[n/2] - d[n/2-1];

	    System.out.println(ans);

	} main {
		Scanner scan = new Scanner(System.in);
	    int n = scan.nextInt();
	    int d[]= new int[n];
	    for(int i=0;i<n;i++) {
	    	d[i]=scan.nextInt();
	    }
	    scan.close();

	    Arrays.sort(d);

	    int ans = d[n/2] - d[n/2-1];

	    System.out.println(ans);

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int d[]= new int[n]; d new int[n] n for(int i=0;i<n;i++) {
	    	d[i]=scan.nextInt();
	    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
	    	d[i]=scan.nextInt();
	    } {
	    	d[i]=scan.nextInt();
	    } d[i]=scan.nextInt() d[i] d i scan.nextInt() scan.nextInt scan scan.close() scan.close scan Arrays.sort(d) Arrays.sort Arrays d int ans = d[n/2] - d[n/2-1]; ans d[n/2] - d[n/2-1] d[n/2] d n/2 n 2 d[n/2-1] d 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) {
		Scanner scan = new Scanner(System.in);
	    int n = scan.nextInt();
	    int d[]= new int[n];
	    for(int i=0;i<n;i++) {
	    	d[i]=scan.nextInt();
	    }
	    scan.close();

	    Arrays.sort(d);

	    int ans = d[n/2] - d[n/2-1];

	    System.out.println(ans);

	}

} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
	    int n = scan.nextInt();
	    int d[]= new int[n];
	    for(int i=0;i<n;i++) {
	    	d[i]=scan.nextInt();
	    }
	    scan.close();

	    Arrays.sort(d);

	    int ans = d[n/2] - d[n/2-1];

	    System.out.println(ans);

	}

} Main
import java.util.Arrays;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
	    int n = scan.nextInt();
	    int d[]= new int[n];
	    for(int i=0;i<n;i++) {
	    	d[i]=scan.nextInt();
	    }
	    scan.close();

	    Arrays.sort(d);

	    int ans = d[n/2] - d[n/2-1];

	    System.out.println(ans);

	}

}