#include <bits/stdc++.h>
using namespace std;
const int maxn = 300000;
int n;
int a[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + 1 + n);
  int m = n - 1 - ((n - 1) >> 1);
  int ans = 0x3f3f3f3f;
  for (int i = 1; i + m <= n; i++) ans = min(ans, a[i + m] - a[i]);
  printf("%d\n", ans);
  return 0;
}
