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