#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x[int(2e5 + 5)], mmin = int(1e9 + 7);
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &x[i]);
  sort(x, x + n);
  for (int i = 0; i < n / 2; i++) mmin = min(mmin, x[i + n / 2] - x[i]);
  printf("%d", mmin);
  return 0;
}
