#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, a[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  int mn = 1e9;
  for (int i = 1; i * 2 <= n; ++i) mn = min(mn, a[i + n / 2] - a[i]);
  printf("%d", mn);
  return 0;
}
