#include <bits/stdc++.h>
using namespace std;
const int MX = 200005;
int n, res = 2e9, a[MX];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int i = n / 2 - 1, j = n - 1;
  while (i >= 0) res = min(res, a[j] - a[i]), i--, j--;
  cout << res << '\n';
  return 0;
}
