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