#include <bits/stdc++.h>
using namespace std;
const int nm = 2e5 + 3;
const long long mod = 1e9 + 7;
int n;
int pos[nm];
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  while (cin >> n) {
    for (int i = 0; i < n; i++) cin >> pos[i];
    sort(pos, pos + n);
    int step = n / 2 - 1;
    int res = pos[n - 1] - pos[0];
    pair<double, int> loc;
    for (int i = 0; i <= step; i++) {
      if (pos[i + n - step - 1] - pos[i] < res) {
        res = pos[i + n - step - 1] - pos[i];
        loc.first = i, loc.second = i + n - step - 1;
      }
    }
    cout << res << endl;
  }
  return 0;
}
