#include <bits/stdc++.h>
using namespace std;
int n, a[200010];
int main() {
  while (cin >> n) {
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n);
    int k = (n - 2) >> 1, ans = -1;
    for (int i = 0; i <= k; i++) {
      int tmp = a[n - 1 - k + i] - a[i];
      if (ans == -1 || ans > tmp) ans = tmp;
    }
    cout << ans << "\n";
  }
}
