#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000100;
const int INF = (1 << 29);
const double EPS = 0.000000001;
const double Pi = acos(-1.0);
int n;
long long x[maxn];
int main() {
  while (cin >> n) {
    for (int i = 1; i <= n; i++) scanf("%I64d", &x[i]);
    sort(x + 1, x + n + 1);
    long long ans = 1e12;
    for (int i = 1; i + n / 2 <= n; i++) {
      long long a = x[i], b = x[i + n / 2];
      ans = min(ans, b - a);
    }
    cout << ans << endl;
  }
  return 0;
}
