#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
const int MAXN = 2e5 + 10;
const int MOD = 1e9 + 7;
const int dir[][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
const int seed = 131;
int cases = 0;
int arr[MAXN];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
  sort(arr, arr + n);
  int ans = INF;
  for (int i = 0; i + n / 2 < n; i++) ans = min(ans, arr[i + n / 2] - arr[i]);
  printf("%d\n", ans);
  return 0;
}
