#include <bits/stdc++.h>
const int MAX_N = 2e5 + 5;
const int INF = 1e9 + 5;
int n, a[MAX_N], ans = INF;
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
  std::cin >> n;
  for (int i = 0; i < n; ++i) std::cin >> a[i];
  std::sort(a, a + n);
  if (n == 2)
    ans = a[1] - a[0];
  else
    for (int i = 0; i + n / 2 < n; ++i)
      ans = std::min(ans, a[i + n / 2] - a[i]);
  std::cout << ans << '\n';
  return 0;
}
