#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 5;
int n, a[maxn], ans = 1e9;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + 1 + n);
  int len = (n / 2) - 1;
  for (int i = len + 2; i <= n; i++) ans = min(ans, abs(a[i] - a[i - len - 1]));
  cout << ans << endl;
}
