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