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