#include <bits/stdc++.h>
using namespace std;
int arr[200000];
int n;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  int maxi = 2000000000;
  for (int i = 0; i < n / 2; i++) {
    if (arr[i + n / 2] - arr[i] < maxi) maxi = arr[i + n / 2] - arr[i];
  }
  cout << maxi << endl;
  return 0;
}
