#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1.01e9;
const double eps = 1e-9;
const int maxn = (int)2e5 + 10;
int a[maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; (i) < (n); ++i) scanf("%d", &a[i]);
  sort(a, a + n);
  int res = inf;
  for (int i = 0; (i) < (n / 2); ++i) res = min(res, a[i + n / 2] - a[i]);
  printf("%d\n", res);
  return 0;
}
