#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int a[200050];
int main() {
  int i, ans, n;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  if (n == 2) ans = a[2] - a[1];
  ans = 2147483647;
  for (i = 1; i <= n / 2; i++) ans = min(ans, a[i + n / 2] - a[i]);
  printf("%d", ans);
}
