#include <bits/stdc++.h>
using namespace std;
const int N = 200055;
int n, a[N];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  sort(a, a + n);
  int t = (n - 1) / 2;
  int m = n - t - 1;
  int res = 1000000000;
  for (int i = 0; i < n; ++i) {
    if (i + m >= n) break;
    res = min(res, a[i + m] - a[i]);
  }
  printf("%d\n", res);
  return 0;
}
