#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int n, arr[maxn], x, ans = 2e9 + 10;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  x = (n - 2) / 2;
  for (int i = 0; i <= n - x - 2; i++) ans = min(ans, arr[i + x + 1] - arr[i]);
  cout << ans << endl;
}
