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