#include <bits/stdc++.h>
const int MAXN = 200000 + 10;
int a[MAXN];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  std::sort(a, a + n);
  int ans = INT_MAX;
  int dis = n / 2;
  if (n == 2)
    printf("%d\n", a[1] - a[0]);
  else {
    for (int i = 0; i + dis < n; i++) {
      ans = std::min(ans, a[i + dis] - a[i]);
    }
    printf("%d\n", ans);
  }
  return 0;
}
