#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[210000];
  int n;
  while (scanf("%d", &n) != EOF) {
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a, a + n);
    int ans = 0x3f3f3f3f;
    for (int i = 0; i + n / 2 < n; i++) {
      if (a[i + n / 2] - a[i] < ans) ans = a[i + n / 2] - a[i];
    }
    cout << ans << endl;
  }
  return 0;
}
