#include <bits/stdc++.h>
using namespace std;
int main() {
  int length;
  int arr[210000];
  int ans = 9999999999;
  cin >> length;
  for (int i = 0; i < length; i++) cin >> arr[i];
  int m = length / 2;
  sort(arr, arr + length);
  for (int i = 0; i < m; i++) ans = min(ans, arr[i + m] - arr[i]);
  cout << ans << endl;
  return 0;
}
