#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[200010];
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1);
  int minn = 1000000010;
  for (int i = n / 2 + 1; i <= n; i++) {
    if (minn > a[i] - a[i - n / 2]) {
      minn = a[i] - a[i - n / 2];
    }
  }
  cout << minn << endl;
  return 0;
}
