#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 1;
const int INF = 1e9;
int a[MAXN];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int answer = INF;
  for (int i = 0; i + n / 2 < n; i++) answer = min(answer, a[i + n / 2] - a[i]);
  cout << answer << endl;
  return 0;
}
