#include <bits/stdc++.h>
using namespace std;
int n;
long long arr[200004];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%lld", &arr[i]);
  sort(arr, arr + n);
  long long ans = 1000000005;
  int trm = (n - 1) >> 1;
  for (int i = 0; i <= trm; ++i) {
    ans = min(ans, arr[n - 1 - trm + i] - arr[i]);
  }
  cout << ans << endl;
  return 0;
}
