#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000002;
const long long INFLL = 100000000000000000ll;
const long long MOD = 1000000007;
int N, X[200005];
vector<int> A;
int main() {
  cin >> N;
  for (int i = (1); i <= (N); i++) scanf("%d", &X[i]);
  sort(X + 1, X + N + 1);
  int play = (N - 1) / 2;
  int ans = INF;
  for (int l = (1); l <= (play + 1); l++) {
    int rem = play - (l - 1);
    int r = N - rem;
    ans = min(ans, X[r] - X[l]);
  }
  cout << ans;
}
