#include <bits/stdc++.h>
using namespace std;
const int mac = 2e5 + 10;
const int inf = 1e9 + 10;
int a[mac];
int main(int argc, char const *argv[]) {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + 1 + n);
  int ans = inf;
  for (int i = 1; i <= n / 2; i++) {
    ans = min(ans, a[i + n / 2] - a[i]);
  }
  printf("%d\n", ans);
  return 0;
}
