#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int n, a[maxn];
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 0; i < n; i++) scanf("%d", &a[i]);
    sort(a, a + n);
    int k = (n - 2) >> 1, ans = -1;
    for (int i = 0; i <= k; i++) {
      int tmp = a[n - 1 - k + i] - a[i];
      if (ans == -1 || ans > tmp) ans = tmp;
    }
    printf("%d\n", ans);
  }
}
