#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
const long long mod = 1000000007;
int n;
long long x[maxn];
int pre[maxn], nxt[maxn];
bool removed[maxn];
typedef struct Seg {
  int s, t;
  Seg(int s = 0, int t = 0) : s(s), t(t) {}
  friend bool operator<(Seg a, Seg b) {
    int k1 = x[a.t] - x[a.s], k2 = x[b.t] - x[b.s];
    if (k1 != k2) return k1 < k2;
    if (a.s != b.s) return a.s < b.s;
    return a.t < b.t;
  }
} Seg;
multiset<Seg> S;
multiset<Seg>::iterator it;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
  sort(x + 1, x + 1 + n);
  int m = (n - 1) / 2;
  long long ret = x[n] - x[1];
  for (int i = 0; i <= m; i++) {
    ret = min(ret, x[n - (m - i)] - x[i + 1]);
  }
  cout << ret << endl;
  return 0;
}
