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