#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
const int INF = (int)1e9 + 7;
const int SZ = (int)200001;
const long double PI = 3.1415926535897932384626433832795;
int a[SZ];
int main() {
  ios::sync_with_stdio(false);
  int n, x[SZ];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> x[i];
  sort(x, x + n);
  int ans = INF;
  for (int i = 0; i < (n + 1) / 2; i++) ans = min(ans, x[i + n / 2] - x[i]);
  cout << ans;
  return 0;
}
