#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const long long MAXN = 1e5 + 7;
const long long MAXM = 1e5 + 7;
const long long MOD = 1e9 + 7;
const double eps = 1e-6;
const double pi = acos(-1.0);
long long a[200005];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  sort(a + 1, a + 1 + n);
  long long ans = 0x3f3f3f3f;
  for (int i = 1; i <= n / 2; i++) ans = min(ans, a[i + n / 2] - a[i]);
  cout << ans << endl;
  return 0;
}
