#include <bits/stdc++.h>
using namespace std;
int n, ar[1000000], ans = 1000000000;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) scanf("%d", &ar[i]);
  sort(ar, ar + n);
  for (int i = 0; i < n / 2; i++) {
    ans = min(ans, ar[i + n / 2] - ar[i]);
  }
  cout << ans;
  return 0;
}
