#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x;
}
int a[200005];
int main() {
  int n = read();
  int ans = 1e9;
  for (int i = 0; i < n; i++) a[i] = read();
  sort(a, a + n);
  for (int i = 0; i < n / 2; i++) ans = min(ans, (a[i + n / 2] - a[i]));
  printf("%d", ans);
  return 0;
}
