#include <bits/stdc++.h>
using namespace std;
long long int n, a[200005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (long long int i = 1; i <= n; ++i) cin >> a[i];
  sort(a + 1, a + n + 1);
  vector<long long int> tem;
  for (long long int i = 1; i <= n / 2; ++i) tem.push_back(a[i + n / 2] - a[i]);
  long long int mi = 1e15;
  for (long long int v : tem) mi = min(mi, v);
  cout << mi << endl;
}
