#include <bits/stdc++.h>
using namespace std;
int n;
const int N = 200005;
long long x[N];
int main() {
  cin >> n;
  for (int(i) = (0); i < (n); ++(i)) {
    cin >> x[i];
  }
  int sides = (n - 2) / 2 + (n % 2);
  int h = n - sides;
  sort(x, x + n);
  long long ans = 1000000001 * 3ll;
  h--;
  for (int(i) = (h); i < (n); ++(i)) {
    ans = min(ans, x[i] - x[i - h]);
  }
  cout << ans;
  return 0;
}
