#include <bits/stdc++.h>
using namespace std;
int n, m, a[200005], ans = 1000000000, i;
int main() {
  cin >> n;
  m = n / 2;
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (i = 0; i < m; i++) ans = min(ans, a[i + m] - a[i]);
  cout << ans << endl;
}
