#include <bits/stdc++.h>
using namespace std;
int a[200009];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int res = int(1e9) + 7;
  sort(a, a + n);
  int add = (n) / 2;
  for (int i = 0; i + add < n; ++i) res = min(res, a[i + add] - a[i]);
  cout << res << endl;
  return 0;
}
