#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const int M = 505;
const int nmax = 1e3 + 5;
const long long inf = 1e9;
const int mod = 1e9 + 7;
const long long P = 31;
const int K = 20;
const long double eps = 1e-9;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
set<double> s;
long long a[N];
int main() {
  ios_base::sync_with_stdio(false);
  long long sum;
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    s.insert(double(a[i]));
    sum += a[i];
  }
  sort(a, a + n);
  long long sm = a[(n >> 1) - 1], bg = a[n >> 1];
  while ((int)s.size() > 2) {
    double med = 1.0 * (sm + bg) / 2.0;
    auto ib = s.begin();
    auto ie = s.end();
    ie--;
    if ((med - *ib) < (*ie - med)) {
      auto it = s.lower_bound(sm);
      sm = *(--it);
      it++;
      sum -= *ie;
      sum -= *it;
      s.erase(ie);
      s.erase(it);
    } else {
      auto it = s.lower_bound(bg);
      bg = *(++it);
      it--;
      sum -= *ib;
      sum -= *it;
      s.erase(ib);
      s.erase(it);
    }
  }
  cout << bg - sm << '\n';
  return 0;
}
