#include <bits/stdc++.h>
int a[200005];
int main() {
  int n, rlt = 1 << 30;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  std::sort(a + 1, a + n + 1);
  for (int i = 1; i <= n / 2; i++) {
    if (rlt > a[i + n / 2] - a[i]) rlt = a[i + n / 2] - a[i];
  }
  printf("%d\n", rlt);
}
