#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
double PI = 4 * atan(1);
int main() {
  int n, k, ans = 1000000000;
  vector<int> ints;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &k);
    ints.push_back(k);
  }
  sort(ints.begin(), ints.end());
  for (int i = 0; i < n / 2; i++) ans = min(ans, ints[i + n / 2] - ints[i]);
  cout << ans;
  return 0;
}
