#include<bits/stdc++.h>
#include<iostream>
#include<math.h>
#include<vector>
#include<set>
#include<queue>
#include<algorithm>
#include<cstring>    //for memset
using namespace std;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

#define lli                      long long int
#define ull                      unsigned long long
#define ld                       long double
#define pi                       acos(-1)
#define pb                       push_back
#define pbk                      pop_back
#define ff                       first
#define ss                       second
#define pii                      pair<int,int>
#define pdd                      pair<double,double>
#define gcd(a,b)                 __gcd(a,b)
#define lcm(a,b)                (a/gcd(a,b))*b
#define all(v)                   v.begin(),v.end()
#define READ                     freopen("in.txt","r",stdin);
#define WRITE                    freopen("outer.txt","w",stdout);
#define mem(array,value)         memset(array,value,sizeof array)
#define TEST_CASE                int t;scanf("%d",&t);for(int z=1;z<=t;z++)
#define PRINT_CASE               printf("Case %d: ",z)
#define LINE_PRINT_CASE          printf("Case %d:\n",z)
#define ordered_set              tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define sf                       scanf
#define pf                       printf
#define inf                      99999999999
#define mod                      1000000007
#define dist(ax,ay,bx,by)        sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by))
#define fastIO                   ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define watch(x)   	            cerr << __LINE__ << ": " << #x << " = " << (x) << '\n'
#define mx 1000005



int main()
{


    int n;
    cin>>n;
    lli a[n+5];
    for(int i=1;i<=n;i++) cin>>a[i];
    sort(a+1,a+n+1);
    int p=n/2;
    cout<<a[p+1]-a[p];
    return 0;
}







