#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
const long long INF = 1e18;
const long long MOD = 1000000007;
long long A[200005];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  sort(A, A + n);
  int x = n / 2;
  x -= 1;
  long long ans = LLONG_MAX;
  for (int i = 0; i <= x; i++) {
    ans = min(ans, A[i + x + 1] - A[i]);
  }
  cout << ans;
  return 0;
}
