#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, res = pow(10, 18);
  cin >> n;
  vector<long long int> v(n);
  for (long long int i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  for (long long int i = 0; i < n / 2; i++) res = min(res, v[i + n / 2] - v[i]);
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int qc = 1;
  for (long long int i = 1; i <= qc; i++) solve();
}
