#include <bits/stdc++.h>
using namespace std;
const int max_n = 2e5 + 5;
int num[max_n];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &num[i]);
  }
  sort(num, num + n);
  int dis = n >> 1;
  int res = 0x7f7f7f7f;
  for (int i = 0; i < (n >> 1); ++i) {
    res = min(res, num[i + dis] - num[i]);
  }
  printf("%d\n", res);
  return 0;
}
