#include <bits/stdc++.h>
using namespace std;
int n, a[200010], ans = 2000000010;
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 - (n / 2); i++) {
    ans = min(ans, a[i + n / 2] - a[i]);
  }
  printf("%d", ans);
  return 0;
}
