#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const int M = 3605;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const double eps = 1e-6;
int n, a[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + 1 + n);
  int best = 2e9;
  for (int i = 1, j = 1 + n / 2; j <= n; i++, j++)
    best = min(best, a[j] - a[i]);
  cout << best << endl;
  return 0;
}
