#include <bits/stdc++.h>
using namespace std;
long long i, n, m, a[200000], q, l, p, k, c[200000], b[200000], j, ans;
string s[200000], ss, s1;
int main() {
  ios_base::sync_with_stdio(0);
  ans = 1000000007;
  cin >> n;
  for (i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + 1 + n);
  for (i = 1; i <= n / 2; i++) {
    ans = min(ans, a[n / 2 + i] - a[i]);
  }
  cout << ans;
  return 0;
}
