#include <bits/stdc++.h>
using namespace std;
vector<int> pos;
int main() {
  int n, ans = -1;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int t;
    scanf("%d", &t);
    pos.push_back(t);
  }
  sort(pos.begin(), pos.end());
  for (int i = 0; i < n / 2; i++) {
    ans = min(ans, pos[i + n / 2] - pos[i]);
    if (ans < 0) ans = pos[i + n / 2] - pos[i];
  }
  printf("%d\n", ans);
  return 0;
}
