#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
const int INF = 0x3f3f3f3f;
int n;
int ori[maxn];
int main() {
  while (cin >> n) {
    int pos = 0;
    for (int i = 0; i < n; i++) scanf("%d", ori + i);
    sort(ori, ori + n);
    int cnt = n - 2;
    cnt /= 2;
    int ans = INF;
    for (int i = 0; i + cnt + 1 < n; i++) {
      ans = min(ans, ori[i + cnt + 1] - ori[i]);
    }
    cout << ans << endl;
  }
}
