#include <bits/stdc++.h>
using namespace std;
int a[200005];
int main() {
  int n;
  int i;
  while (scanf("%d", &n) != EOF) {
    for (i = 0; i < n; i++) {
      scanf("%d", &a[i]);
    }
    sort(a, a + n);
    int p = (n - 2) / 2;
    int ans = 1e9;
    for (i = 0; i < n - p - 1; i++) {
      int dis = a[i + p + 1] - a[i];
      if (ans > dis) ans = dis;
    }
    printf("%d\n", ans);
  }
  return 0;
}
