#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 1;
int n, a[N], ans = 1e9;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  int x = n / 2;
  for (int i = 1; i <= n; i++) {
    if (i + x <= n) {
      ans = min(ans, a[i + x] - a[i]);
    }
  }
  cout << ans << endl;
}
