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