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