#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long INF_LL = 4e18;
const double pi = acos(-1.0);
template <class T>
T& smin(T& a, const T& b) {
  if (a > b) a = b;
  return a;
}
template <class T>
T& smax(T& a, const T& b) {
  if (a < b) a = b;
  return a;
}
template <class T>
T sqr(const T& a) {
  return a * a;
}
template <typename Iterator>
void print(const char* fmt, Iterator begin, Iterator end,
           const char* delimiter = " ", const char* closing = "\n") {
  for (; begin != end; ++begin != end ? printf("%s", delimiter) : 0)
    printf(fmt, *begin);
  printf("%s", closing);
}
const int N = 2e5 + 5;
int n, x[N];
int main() {
  cin.tie(NULL);
  scanf("%d", &n);
  for (int i(0), _b(n); i < _b; ++i) scanf("%d", x + i);
  sort(x, x + n);
  int ans = INF;
  for (int i(0), _b(n / 2); i < _b; ++i) smin(ans, x[i + n / 2] - x[i]);
  printf("%d\n", ans);
  return 0;
}
