#include <bits/stdc++.h>
using namespace std;
long long a[200200], n, res;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  int x1 = (n - 2) / 2;
  long long res = 9999999999999;
  for (int i = 1; i < n - x1; i++) res = min(res, a[i + x1 + 1] - a[i]);
  cout << res;
}
