#include <bits/stdc++.h>
using namespace std;
long long i, j, k, m, M, n, s, co, ans = 999999999999, f, len, T, r, t;
long long a[200001];
int main() {
  scanf("%lld", &n), t = n / 2;
  for (i = 1; i <= n; i++) scanf("%lld", &a[i]);
  sort(a + 1, a + n + 1);
  for (i = 1; i <= t; i++) ans = min(ans, a[t + i] - a[i]);
  printf("%lld", ans);
  return 0;
}
