#include <bits/stdc++.h>
using namespace std;
long long n, ans = 1000000000000;
long long a[200000];
int main() {
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (long long i = 0; i <= (n - 2) / 2; i++) {
    ans = min(ans, a[i + (n - 2) / 2 + 1] - a[i]);
  }
  cout << ans << "\n";
}
