import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int count = 0;
    int[] ary = new int[n];
    for(int c = 0;c<n;c++){
      ary[c] = sc.nextInt();
    }
    Arrays.sort(ary);
    int a = n/2;
    int b = 0;
    if(ary[a]!=ary[a-1]){
      b = ary[a-1];
      count = ary[a] - b;
    } 
    System.out.println(count);
  } 
} import java.util.*; util.* java public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int count = 0;
    int[] ary = new int[n];
    for(int c = 0;c<n;c++){
      ary[c] = sc.nextInt();
    }
    Arrays.sort(ary);
    int a = n/2;
    int b = 0;
    if(ary[a]!=ary[a-1]){
      b = ary[a-1];
      count = ary[a] - b;
    } 
    System.out.println(count);
  } 
} Main public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int count = 0;
    int[] ary = new int[n];
    for(int c = 0;c<n;c++){
      ary[c] = sc.nextInt();
    }
    Arrays.sort(ary);
    int a = n/2;
    int b = 0;
    if(ary[a]!=ary[a-1]){
      b = ary[a-1];
      count = ary[a] - b;
    } 
    System.out.println(count);
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int count = 0;
    int[] ary = new int[n];
    for(int c = 0;c<n;c++){
      ary[c] = sc.nextInt();
    }
    Arrays.sort(ary);
    int a = n/2;
    int b = 0;
    if(ary[a]!=ary[a-1]){
      b = ary[a-1];
      count = ary[a] - b;
    } 
    System.out.println(count);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int count = 0; count 0 int[] ary = new int[n]; ary new int[n] n for(int c = 0;c<n;c++){
      ary[c] = sc.nextInt();
    } int c = 0; int c = 0; c 0 c<n c n c++ c++ c {
      ary[c] = sc.nextInt();
    } {
      ary[c] = sc.nextInt();
    } ary[c] = sc.nextInt() ary[c] ary c sc.nextInt() sc.nextInt sc Arrays.sort(ary) Arrays.sort Arrays ary int a = n/2; a n/2 n 2 int b = 0; b 0 if(ary[a]!=ary[a-1]){
      b = ary[a-1];
      count = ary[a] - b;
    } ary[a]!=ary[a-1] ary[a] ary a ary[a-1] ary a-1 a 1 {
      b = ary[a-1];
      count = ary[a] - b;
    } b = ary[a-1] b ary[a-1] ary a-1 a 1 count = ary[a] - b count ary[a] - b ary[a] ary a b System.out.println(count) System.out.println System.out System System.out count String args[] args public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int count = 0;
    int[] ary = new int[n];
    for(int c = 0;c<n;c++){
      ary[c] = sc.nextInt();
    }
    Arrays.sort(ary);
    int a = n/2;
    int b = 0;
    if(ary[a]!=ary[a-1]){
      b = ary[a-1];
      count = ary[a] - b;
    } 
    System.out.println(count);
  } 
} public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int count = 0;
    int[] ary = new int[n];
    for(int c = 0;c<n;c++){
      ary[c] = sc.nextInt();
    }
    Arrays.sort(ary);
    int a = n/2;
    int b = 0;
    if(ary[a]!=ary[a-1]){
      b = ary[a-1];
      count = ary[a] - b;
    } 
    System.out.println(count);
  } 
} Main
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int count = 0;
    int[] ary = new int[n];
    for(int c = 0;c<n;c++){
      ary[c] = sc.nextInt();
    }
    Arrays.sort(ary);
    int a = n/2;
    int b = 0;
    if(ary[a]!=ary[a-1]){
      b = ary[a-1];
      count = ary[a] - b;
    } 
    System.out.println(count);
  } 
}