#include <bits/stdc++.h>
using namespace std;
int N, a[200100];
int main() {
  scanf("%d", &N);
  int B = N / 2;
  for (int i = 1; i <= N; ++i) {
    scanf("%d", &a[i]);
  }
  sort(a + 1, a + N + 1);
  int rez = 1000000007;
  for (int i = 1; i + B <= N; ++i) {
    if (rez > a[i + B] - a[i]) {
      rez = a[i + B] - a[i];
    }
  }
  cout << rez << "\n";
  return 0;
}
