#include <bits/stdc++.h>
using namespace std;
int a[200011];
void smin(int &u, int v) {
  if (u > v) u = v;
}
int main() {
  int n;
  cin >> n;
  int ans = 1000000000;
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n / 2; i++) smin(ans, abs(a[i + n / 2] - a[i]));
  cout << ans << endl;
  return 0;
}
