#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 7;
int n, i, ans = inf;
int A[N];
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", A + i);
  sort(A + 1, A + n + 1);
  for (i = 1; i <= n; i++)
    if (i + n / 2 <= n) ans = min(ans, A[i + n / 2] - A[i]);
  cout << ans;
}
