#include <bits/stdc++.h>
using namespace std;
using namespace std;
void solve() {
  int n;
  scanf("%d", &n);
  set<int> x;
  for (int i = 0; i < n; ++i) {
    int cur;
    scanf("%d", &cur);
    x.insert(cur);
  }
  set<int>::iterator l = x.begin();
  set<int>::iterator r = l;
  advance(r, n / 2);
  int ans = INT_MAX;
  for (int i = 0; i < n / 2; ++i) ans = min(ans, *r++ - *l++);
  printf("%d", ans);
}
int main() {
  solve();
  return 0;
}
