#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
const long long mod = 1e9 + 7;
int n, k, m;
long long a[MAXN], b[MAXN];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
  }
  sort(a + 1, a + 1 + n);
  long long ans = 1LL << 60;
  for (int i = 1; i <= n / 2; ++i) {
    b[i] = a[i + n / 2] - a[i];
  }
  sort(b + 1, b + 1 + n / 2);
  printf("%lld\n", b[1]);
  return 0;
}
