#include <bits/stdc++.h>
using namespace std;
long long OO = 1e18;
long long Mod = 1e9 + 7;
long long const N = 2e5 + 10;
int a[N];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int ans = 1e9;
  for (int i = 0; i <= n / 2 - 1; i++) {
    ans = min(ans, a[i + n / 2] - a[i]);
  }
  cout << ans << endl;
}
