#include <bits/stdc++.h>
using namespace std;
inline long double min(long double a, long double b) {
  if (a < b) return a;
  return b;
}
inline long double max(long double a, long double b) {
  if (a < b) return b;
  return a;
}
int n;
int arr[200010];
int main() {
  cin >> n;
  for (int(i) = (0); (i) < (n); ++(i)) scanf("%d", &arr[i]);
  sort(arr, arr + n);
  int res = arr[n - 1] - arr[0];
  for (int(i) = (0); (i) < (n / 2); ++(i)) {
    res = min(res, arr[i + n / 2] - arr[i]);
  }
  cout << res << endl;
  return 0;
}
