#include <bits/stdc++.h>
const double EPS = 1e-10;
using namespace std;
inline int rit() {
  int f = 0, key = 1;
  char c;
  do {
    c = getchar();
    if (c == '-') key = -1;
  } while (c < '0' || c > '9');
  do {
    f = f * 10 + c - '0';
    c = getchar();
  } while (c >= '0' && c <= '9');
  return f * key;
}
int a[200005];
void read() {
  int n, i, ans;
  n = rit();
  for (i = 0; i < n; i++) a[i] = rit();
  sort(a, a + n);
  for (i = 0, ans = 1e9; i + n / 2 < n; i++)
    ans = min(ans, a[i + n / 2] - a[i]);
  cout << ans << endl;
}
int main() {
  read();
  return 0;
}
