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