#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 7;
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 minn = 0x3f3f3f3f;
  int len = (n - 2) / 2;
  for (int i = 0; i < n; i++) {
    if (i + len + 1 >= n) break;
    minn = min(minn, arr[i + len + 1] - arr[i]);
  }
  printf("%d", minn);
  return 0;
}
