#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10, inf = 1e9 + 7;
int a[MAXN], p1[MAXN];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + 1 + n);
  int k = (n - 2) / 2, ans = inf;
  for (int i = 2; i + k <= n; i++) {
    int x = a[i + k] - a[i - 1];
    ans = min(ans, x);
  }
  cout << ans << endl;
  return 0;
}
