#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int A[n];
  for (int i = 0; i < n; i++) cin >> A[i];
  sort(A, A + n);
  int s = 0;
  int e = n - (n / 2 - 1) - 1;
  int mi = 1000000001;
  while (e < n) {
    if (A[e] - A[s] < mi) mi = A[e] - A[s];
    s++;
    e++;
  }
  cout << mi;
  return 0;
}
