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