#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> x(n);
  for (int i = 0; i < n; ++i) {
    cin >> x[i];
  }
  sort(x.begin(), x.end());
  int res = 1000000000;
  int d = (n - 2) / 2 + 1;
  for (int i = 0; i + d < n; ++i) {
    res = min(res, x[i + d] - x[i]);
  }
  cout << res;
  return 0;
}
