#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[200004];
  int n, a;
  while (cin >> n) {
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
    }
    sort(arr, arr + n);
    int end = (n - 2) / 2;
    int mid = end;
    if (n % 2 == 1) end = end + 1;
    int result = -1;
    for (int i = 0; i < (n - end) - 1; i++) {
      if (result == -1)
        result = arr[i + mid + 1] - arr[i];
      else {
        if (result > arr[i + mid + 1] - arr[i])
          result = arr[i + mid + 1] - arr[i];
      }
    }
    cout << result << endl;
  }
}
