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