#include <bits/stdc++.h>
using namespace std;
int arr[200001];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
  sort(arr, arr + n);
  int k = n - (n - 2) / 2;
  int ans = INT_MAX;
  for (int i = 0; i <= n - k; i++) {
    int dif = arr[i + k - 1] - arr[i];
    ans = min(ans, dif);
  }
  printf("%d\n", ans);
  return 0;
}
