#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int a[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  int lim = n / 2 - 1, res = 1e9 + 7;
  for (int i = 0; i <= lim; i++) {
    res = min(res, a[n - (lim - i)] - a[i + 1]);
  }
  printf("%d\n", res);
  return 0;
}
