#include <bits/stdc++.h>
using namespace std;
ostream &operator<<(ostream &out, const pair<int, int> &a) {
  return out << '(' << a.first << ", " << a.second << ')';
}
istream &operator>>(istream &in, pair<int, int> &a) {
  return in >> a.first >> a.second;
}
int n, a[200000], nxt[200000], prv[200000];
set<pair<int, int> > heap;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  int ans = 1e9 + 1;
  for (int i = 0; i < n / 2; i++) {
    ans = min(ans, a[i + n / 2] - a[i]);
  }
  cout << ans << endl;
  return 0;
}
