#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  long long a[(int)3e5];
  long long ans = (long long)2e9;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (int i = 0; i < n / 2; i++) ans = min(ans, abs(a[i + n / 2] - a[i]));
  cout << ans;
  return 0;
}
