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