#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-13;
const long double PI = acos(-1);
const int INF = (int)1e9;
const long long INFF = (long long)1e18;
const int mod = (int)1e9 + 7;
const int MXN = (int)2e5 + 7;
int a[MXN];
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 = INF;
  for (int i = 0; i <= n / 2 - 1; i++) {
    int ll = a[i + 1];
    int rr = a[i + 1 + n / 2];
    ans = min(ans, rr - ll);
  }
  printf("%d\n", ans);
  return 0;
}
