import java.util.*;
public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] d = new int[N];

    for (int i = 0; i < N; i++) {
      d[i] = sc.nextInt();
    }
    sc.close();

    Arrays.sort(d);

    int[] a = new int[N/2];
    int[] b = new int[N/2];

    for (int i = 0; i < N/2; i++) {
      a[i] = d[i]; 
    }

    int j = 0;
    for (int i = N/2; i < N; i++) {
      b[j] = d[i];
      j++;
    }

    int count = 0;
    if (a[N/2-1] < b[0]){
      count = b[0] - a[N/2-1];
    }

    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[] d = new int[N];

    for (int i = 0; i < N; i++) {
      d[i] = sc.nextInt();
    }
    sc.close();

    Arrays.sort(d);

    int[] a = new int[N/2];
    int[] b = new int[N/2];

    for (int i = 0; i < N/2; i++) {
      a[i] = d[i]; 
    }

    int j = 0;
    for (int i = N/2; i < N; i++) {
      b[j] = d[i];
      j++;
    }

    int count = 0;
    if (a[N/2-1] < b[0]){
      count = b[0] - a[N/2-1];
    }

    System.out.println(count);

  }
  
} Main public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] d = new int[N];

    for (int i = 0; i < N; i++) {
      d[i] = sc.nextInt();
    }
    sc.close();

    Arrays.sort(d);

    int[] a = new int[N/2];
    int[] b = new int[N/2];

    for (int i = 0; i < N/2; i++) {
      a[i] = d[i]; 
    }

    int j = 0;
    for (int i = N/2; i < N; i++) {
      b[j] = d[i];
      j++;
    }

    int count = 0;
    if (a[N/2-1] < b[0]){
      count = b[0] - a[N/2-1];
    }

    System.out.println(count);

  } main {

    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] d = new int[N];

    for (int i = 0; i < N; i++) {
      d[i] = sc.nextInt();
    }
    sc.close();

    Arrays.sort(d);

    int[] a = new int[N/2];
    int[] b = new int[N/2];

    for (int i = 0; i < N/2; i++) {
      a[i] = d[i]; 
    }

    int j = 0;
    for (int i = N/2; i < N; i++) {
      b[j] = d[i];
      j++;
    }

    int count = 0;
    if (a[N/2-1] < b[0]){
      count = b[0] - a[N/2-1];
    }

    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[] d = new int[N]; d new int[N] N for (int i = 0; i < N; i++) {
      d[i] = sc.nextInt();
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      d[i] = sc.nextInt();
    } {
      d[i] = sc.nextInt();
    } d[i] = sc.nextInt() d[i] d i sc.nextInt() sc.nextInt sc sc.close() sc.close sc Arrays.sort(d) Arrays.sort Arrays d int[] a = new int[N/2]; a new int[N/2] N/2 N 2 int[] b = new int[N/2]; b new int[N/2] N/2 N 2 for (int i = 0; i < N/2; i++) {
      a[i] = d[i]; 
    } int i = 0; int i = 0; i 0 i < N/2 i N/2 N 2 i++ i++ i {
      a[i] = d[i]; 
    } {
      a[i] = d[i]; 
    } a[i] = d[i] a[i] a i d[i] d i int j = 0; j 0 for (int i = N/2; i < N; i++) {
      b[j] = d[i];
      j++;
    } int i = N/2; int i = N/2; i N/2 N 2 i < N i N i++ i++ i {
      b[j] = d[i];
      j++;
    } {
      b[j] = d[i];
      j++;
    } b[j] = d[i] b[j] b j d[i] d i j++ j int count = 0; count 0 if (a[N/2-1] < b[0]){
      count = b[0] - a[N/2-1];
    } a[N/2-1] < b[0] a[N/2-1] a N/2-1 N/2 N 2 1 b[0] b 0 {
      count = b[0] - a[N/2-1];
    } count = b[0] - a[N/2-1] count b[0] - a[N/2-1] b[0] b 0 a[N/2-1] a N/2-1 N/2 N 2 1 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[] d = new int[N];

    for (int i = 0; i < N; i++) {
      d[i] = sc.nextInt();
    }
    sc.close();

    Arrays.sort(d);

    int[] a = new int[N/2];
    int[] b = new int[N/2];

    for (int i = 0; i < N/2; i++) {
      a[i] = d[i]; 
    }

    int j = 0;
    for (int i = N/2; i < N; i++) {
      b[j] = d[i];
      j++;
    }

    int count = 0;
    if (a[N/2-1] < b[0]){
      count = b[0] - a[N/2-1];
    }

    System.out.println(count);

  }
  
} public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] d = new int[N];

    for (int i = 0; i < N; i++) {
      d[i] = sc.nextInt();
    }
    sc.close();

    Arrays.sort(d);

    int[] a = new int[N/2];
    int[] b = new int[N/2];

    for (int i = 0; i < N/2; i++) {
      a[i] = d[i]; 
    }

    int j = 0;
    for (int i = N/2; i < N; i++) {
      b[j] = d[i];
      j++;
    }

    int count = 0;
    if (a[N/2-1] < b[0]){
      count = b[0] - a[N/2-1];
    }

    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[] d = new int[N];

    for (int i = 0; i < N; i++) {
      d[i] = sc.nextInt();
    }
    sc.close();

    Arrays.sort(d);

    int[] a = new int[N/2];
    int[] b = new int[N/2];

    for (int i = 0; i < N/2; i++) {
      a[i] = d[i]; 
    }

    int j = 0;
    for (int i = N/2; i < N; i++) {
      b[j] = d[i];
      j++;
    }

    int count = 0;
    if (a[N/2-1] < b[0]){
      count = b[0] - a[N/2-1];
    }

    System.out.println(count);

  }
  
}