#include <bits/stdc++.h>
using namespace std;
const int maxn = 200006;
int a[maxn];
int n;
int dp[maxn];
int panduan1(int p) {
  int s = 0;
  for (int i = 2; i <= n; i++) {
    if (a[i] - a[i - 1] >= p) {
      s += dp[i - 1];
      continue;
    }
    int le = 1, ri = i - 1;
    int mid;
    while (le <= ri) {
      mid = (le + ri) / 2;
      if (a[i] - a[mid] >= p)
        ri = mid - 1;
      else
        le = mid + 1;
    }
    dp[i] = dp[ri] + i - ri;
  }
  return s;
}
int panduan2(int p) {
  int s = 1000000000;
  for (int i = 2; i <= n; i++) {
    int le = 1, ri = i - 1;
    int mid;
    while (le <= ri) {
      mid = (le + ri) / 2;
      if (a[i] - a[mid] >= p)
        ri = mid - 1;
      else
        le = mid + 1;
    }
    s = min(s, ri + n - i);
  }
  return s;
}
int main() {
  int i;
  cin >> n;
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + 1 + n);
  int x = 1000000000;
  for (i = 0; i <= (n - 2 + 1) / 2; i++) {
    x = min(x, a[n - ((n - 2 + 1) / 2 - i)] - a[i + 1]);
  }
  cout << x << endl;
}
