#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 50;
long long a[maxn];
int main(void) {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + 1 + n);
  long long ans = 1e10;
  for (int i = 1; i + n / 2 <= n; i++) ans = min(ans, a[i + n / 2] - a[i]);
  cout << ans << endl;
}
