#include <bits/stdc++.h>
using namespace std;
void in() {}
int main() {
  in();
  int n, arr[200100], a = 1e9;
  cin >> n;
  for (int i = 0; i < n; ++i) scanf("%d", arr + i);
  sort(arr, arr + n);
  for (int i = 0; i < n / 2; ++i) {
    a = min(a, arr[i + n / 2] - arr[i]);
  }
  cout << a << endl;
  return 0;
}
