#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, res, min, move[200001];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> move[i];
  sort(move, move + n);
  n /= 2;
  min = 1e9;
  for (int i = 0; i < n; i++) {
    res = move[i + n] - move[i];
    if (res < min) min = res;
  }
  cout << min << endl;
  return 0;
}
