#include <bits/stdc++.h>
using namespace std;
int a, b[2000005], ans = 0x3f3f3f3f;
int main() {
  cin >> a;
  for (int i = 1; i <= a; i++) cin >> b[i];
  sort(b + 1, b + a + 1);
  for (int i = 1; i <= a / 2; i++) ans = min(ans, b[i + a / 2] - b[i]);
  cout << ans << endl;
  return 0;
}
