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