#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 50;
int n, a[maxn];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + 1 + n);
  int ans = 1e9;
  for (int i = n / 2 + 1; i <= n; i++) ans = min(ans, a[i] - a[i - n / 2]);
  cout << ans << endl;
  return 0;
}
