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