#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long int n;
  cin >> n;
  vector<long long int> a(n);
  for (long long int i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  long long int messi = a[n / 2] - a[0];
  for (long long int i = 1; i < n / 2; i++)
    messi = min(messi, a[n / 2 + i] - a[i]);
  cout << messi << endl;
  return 0;
}
