#include <bits/stdc++.h>
using namespace std;
vector<unsigned long long> arr;
bool cmp(int a, int b) { return a < b; }
int main() {
  int n;
  cin >> n;
  arr.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  sort(arr.begin(), arr.end(), cmp);
  unsigned long long min = 1e+19 + 1;
  for (int i = 0; i < n / 2; ++i) {
    if (arr[i + n / 2] - arr[i] < min) {
      min = arr[i + n / 2] - arr[i];
    }
  }
  cout << min;
  return 0;
}
