#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,a;
	cin>>n;
	multiset<int>m;
	//map<pair<int,int>>m1;
	for(int i=1;i<=n;i++)
	{
		cin>>a;
		m.insert(a);
		//m[i]=a;
	}
	int p;
 multiset<int>::iterator it = m.begin();
advance(it, m.size()/2);
int median = *it;
it--;
if(*it==median)
	cout<<0<<endl;
else  p=(median-*it);
cout<<p<<endl;
}