#include <bits/stdc++.h>
using namespace std;
int n;
int x[200100];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &x[i]);
  sort(x, x + n);
  int m = (n - 2) / 2;
  int ans = 2000000000;
  for (int i = 0; i < n; i++) {
    if (i + m + 1 >= n) continue;
    ans = min(ans, x[i + m + 1] - x[i]);
  }
  cout << ans << endl;
  return 0;
}
