#include <bits/stdc++.h>
using namespace std;
const int maxn = 2000001;
int n, x, y, z, m, ans = 1e9 + 1, a[maxn];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n / 2; i++) ans = min(a[i + n / 2] - a[i], ans);
  cout << ans;
}
