#include <bits/stdc++.h>
using namespace std;
int i, j, k, l, n, m, s, an, K, X, tot = 1, oo, sum;
const int N = 210000;
int a[N], g[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(&a[1], &a[n + 1]);
  int s = n - (n - 2 + 1) / 2;
  an = a[n];
  for (int i = s; i <= n; i++) an = min(an, a[i] - a[i - s + 1]);
  printf("%d\n", an);
}
