#include <bits/stdc++.h>
using namespace std;
int n, x[200005], dp[1 << 17][2];
int solve(int mask, int turn) {
  if (dp[mask][turn] > -1) return dp[mask][turn];
  if (__builtin_popcount(mask) == 2) {
    int a = -1, b = -1;
    for (int i = 0; mask; i++, mask /= 2) {
      if (mask & 1) {
        if (a == -1)
          a = i;
        else
          b = i;
      }
    }
    return abs(x[a] - x[b]);
  }
  if (turn == 0) {
    int a = 1e9, b = 0;
    for (int i = 0; i < n; i++) {
      if (mask & (1 << i)) {
        int k = solve(mask - (1 << i), turn ^ 1);
        if (k < a) a = k, b = i;
      }
    }
    return dp[mask][turn] = a;
  } else {
    int a = 0, b = 0;
    for (int i = 0; i < n; i++) {
      if (mask & (1 << i)) {
        int k = solve(mask - (1 << i), turn ^ 1);
        if (k > a) a = k, b = i;
      }
    }
    return dp[mask][turn] = a;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &x[i]);
  sort(x, x + n);
  int an = 2e9;
  for (int i = 0, j = (n / 2); j < n; i++, j++) an = min(an, x[j] - x[i]);
  printf("%d", an);
  return 0;
}
