#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 2e5 + 10;
const long long INF = 1e15 + 10;
long long a[MAXN];
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  long long n, res = INF;
  ;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  for (long long i = 0; i + (n / 2) < n; i++) {
    res = min(res, a[i + (n / 2)] - a[i]);
  }
  cout << res;
}
