#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int a[200007];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  sort(a, a + n);
  int c = n / 2 - 1;
  int l = 0, r = n - 1;
  int mn = 1e9 + 77;
  for (int i = 0; i <= c; i++) {
    mn = min(mn, a[r - c + i] - a[l + i]);
  }
  cout << mn;
  return 0;
}
