#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
int a[N];
int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 0; i < (int)(n); ++i) {
    cin >> a[i];
  }
  sort(a, a + n);
  int firstSteps = (n - 1) / 2;
  int ans = 1e9;
  for (int i = 0; i < (int)(n); ++i) {
    int left = i;
    int right = firstSteps - left;
    if (right < 0) continue;
    ans = min(ans, a[n - 1 - right] - a[i]);
  }
  cout << ans;
  return 0;
}
