import java.util.*;
public class Main {
	//定義関数から参照できる変数定義はこの辺
	static int N;
	static int [] Ary;
	static int ans=0;
	
	//分けて宣言する場合
	//int [] var;
	//var = new int [num];
	
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		Ary = new int[N+1];
		for(int i=1;i<=N;i++){
			Ary[i] = sc.nextInt();
		}

		Arrays.sort(Ary);
		
		if (Ary[N/2]<Ary[N/2+1]) {
			ans=Ary[N/2+1]-Ary[N/2];
		}
		else{
			ans=0;
		}
		System.out.println(ans);
		//System.out.print(ans);
    }
    //関数定義
	//public static int funk(long X,long A) {
    //    return ;    
    //}
} import java.util.*; util.* java public class Main {
	//定義関数から参照できる変数定義はこの辺
	static int N;
	static int [] Ary;
	static int ans=0;
	
	//分けて宣言する場合
	//int [] var;
	//var = new int [num];
	
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		Ary = new int[N+1];
		for(int i=1;i<=N;i++){
			Ary[i] = sc.nextInt();
		}

		Arrays.sort(Ary);
		
		if (Ary[N/2]<Ary[N/2+1]) {
			ans=Ary[N/2+1]-Ary[N/2];
		}
		else{
			ans=0;
		}
		System.out.println(ans);
		//System.out.print(ans);
    }
    //関数定義
	//public static int funk(long X,long A) {
    //    return ;    
    //}
} Main //定義関数から参照できる変数定義はこの辺
	static int N; N static int [] Ary; Ary static int ans=0; ans 0 public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		Ary = new int[N+1];
		for(int i=1;i<=N;i++){
			Ary[i] = sc.nextInt();
		}

		Arrays.sort(Ary);
		
		if (Ary[N/2]<Ary[N/2+1]) {
			ans=Ary[N/2+1]-Ary[N/2];
		}
		else{
			ans=0;
		}
		System.out.println(ans);
		//System.out.print(ans);
    } main {
    	Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		Ary = new int[N+1];
		for(int i=1;i<=N;i++){
			Ary[i] = sc.nextInt();
		}

		Arrays.sort(Ary);
		
		if (Ary[N/2]<Ary[N/2+1]) {
			ans=Ary[N/2+1]-Ary[N/2];
		}
		else{
			ans=0;
		}
		System.out.println(ans);
		//System.out.print(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) N = sc.nextInt() N sc.nextInt() sc.nextInt sc Ary = new int[N+1] Ary new int[N+1] N+1 N 1 for(int i=1;i<=N;i++){
			Ary[i] = sc.nextInt();
		} int i=1; int i=1; i 1 i<=N i N i++ i++ i {
			Ary[i] = sc.nextInt();
		} {
			Ary[i] = sc.nextInt();
		} Ary[i] = sc.nextInt() Ary[i] Ary i sc.nextInt() sc.nextInt sc Arrays.sort(Ary) Arrays.sort Arrays Ary if (Ary[N/2]<Ary[N/2+1]) {
			ans=Ary[N/2+1]-Ary[N/2];
		}
		else{
			ans=0;
		} Ary[N/2]<Ary[N/2+1] Ary[N/2] Ary N/2 N 2 Ary[N/2+1] Ary N/2+1 N/2 N 2 1 {
			ans=Ary[N/2+1]-Ary[N/2];
		} ans=Ary[N/2+1]-Ary[N/2] ans Ary[N/2+1]-Ary[N/2] Ary[N/2+1] Ary N/2+1 N/2 N 2 1 Ary[N/2] Ary N/2 N 2 {
			ans=0;
		} ans=0 ans 0 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	//定義関数から参照できる変数定義はこの辺
	static int N;
	static int [] Ary;
	static int ans=0;
	
	//分けて宣言する場合
	//int [] var;
	//var = new int [num];
	
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		Ary = new int[N+1];
		for(int i=1;i<=N;i++){
			Ary[i] = sc.nextInt();
		}

		Arrays.sort(Ary);
		
		if (Ary[N/2]<Ary[N/2+1]) {
			ans=Ary[N/2+1]-Ary[N/2];
		}
		else{
			ans=0;
		}
		System.out.println(ans);
		//System.out.print(ans);
    }
    //関数定義
	//public static int funk(long X,long A) {
    //    return ;    
    //}
} public class Main {
	//定義関数から参照できる変数定義はこの辺
	static int N;
	static int [] Ary;
	static int ans=0;
	
	//分けて宣言する場合
	//int [] var;
	//var = new int [num];
	
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		Ary = new int[N+1];
		for(int i=1;i<=N;i++){
			Ary[i] = sc.nextInt();
		}

		Arrays.sort(Ary);
		
		if (Ary[N/2]<Ary[N/2+1]) {
			ans=Ary[N/2+1]-Ary[N/2];
		}
		else{
			ans=0;
		}
		System.out.println(ans);
		//System.out.print(ans);
    }
    //関数定義
	//public static int funk(long X,long A) {
    //    return ;    
    //}
} Main
import java.util.*;
public class Main {
	//定義関数から参照できる変数定義はこの辺
	static int N;
	static int [] Ary;
	static int ans=0;
	
	//分けて宣言する場合
	//int [] var;
	//var = new int [num];
	
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		Ary = new int[N+1];
		for(int i=1;i<=N;i++){
			Ary[i] = sc.nextInt();
		}

		Arrays.sort(Ary);
		
		if (Ary[N/2]<Ary[N/2+1]) {
			ans=Ary[N/2+1]-Ary[N/2];
		}
		else{
			ans=0;
		}
		System.out.println(ans);
		//System.out.print(ans);
    }
    //関数定義
	//public static int funk(long X,long A) {
    //    return ;    
    //}
}
