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