#include <bits/stdc++.h>
using namespace std;
const long long p = 1000000000 + 7;
template <typename T>
struct point {
  T x, y;
  double length(const T &xt, const T &yt) {
    return (double)sqrt((double)(x - xt) * (x - xt) + (y - yt) * (y - yt));
  }
  double length(const point<T> &v) {
    return (double)sqrt((double)(x - v.x) * (x - v.x) + (y - v.y) * (y - v.y));
  }
  T kosp(const point<T> &v1, const point<T> &v2) {
    return (v1.x - x) * (v2.y - y) - (v1.y - y) * (v2.x - x);
  }
  T vecp(const point<T> &v1, const point<T> &v2) {
    return (v1.x - x) * (v2.x - x) + (v1.y - y) * (v2.y - y);
  }
  point<T>() : x(0), y(0) {}
  point<T>(T a, T b) : x(a), y(b) {}
};
template <typename T>
struct trpoint {
  T x, y, z, r;
  bool fl;
  double length(const T &xt, const T &yt, const T &zt) {
    return (double)sqrt((double)(x - xt) * (x - xt) + (y - yt) * (y - yt) +
                        (z - zt) * (z - zt));
  }
  double length(const trpoint<T> &v) {
    return (double)sqrt((double)(x - v.x) * (x - v.x) + (y - v.y) * (y - v.y) +
                        (z - v.z) * (z - v.z));
  }
};
long long gcd(long long a, long long b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
int main() {
  int n;
  cin >> n;
  vector<long long> mas(n);
  for (int i = 0; i < n; i++) {
    cin >> mas[i];
  }
  sort((mas).begin(), (mas).end());
  int l = (n - 2) / 2 + 1;
  long long mi = 1E11;
  for (int i = 0; i < n - l; i++) {
    if (mas[l + i] - mas[i] < mi) {
      mi = mas[l + i] - mas[i];
    }
  }
  cout << mi;
  return 0;
}
