#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false), cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int &it : a) cin >> it;
  sort(a.begin(), a.end());
  int m = n / 2;
  int ans = INT_MAX;
  for (int i = 0; i < m; i++) {
    ans = min(ans, a[i + m] - a[i]);
  }
  cout << ans << '\n';
  return 0;
}
