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