#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int a[maxn];
int n;
int main() {
  while (scanf("%d", &n) != EOF) {
    int ans = INT_MAX;
    for (int i = 0; i < n; i++) scanf("%d", &a[i]);
    sort(a, a + n);
    int d = n / 2;
    for (int i = 0; i + d < n; i++) {
      ans = min(ans, a[i + d] - a[i]);
    }
    cout << ans << endl;
  }
  return 0;
}
