#include <bits/stdc++.h>
using namespace std;
constexpr int MAXN = 200000;
int x[MAXN + 2];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> x[i];
  sort(x, x + n);
  int ans = INT_MAX;
  for (int i = 0; i < n / 2; i++) ans = min(ans, x[i + n / 2] - x[i]);
  cout << ans << endl;
}
