stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



#define trace(...) __f( #__VA_ARGS__ , __VA_ARGS__ )

template <typename Arg1>

void __f( const char* name , Arg1&& arg1 ) {

        cerr << name << " : " << arg1 << "\n";

}

template <typename Arg1, typename... Args>

void __f( const char* na , Arg1&& arg1 , Args&&... args ) {

        const char* c = strchr( na + 1 , ',' );

        cerr.write( na , c - na ) << " : " << arg1 << " , ";

        __f( c + 1 , args... );

}

#define endl "\n"

#define all(V) V.begin(),V.end()

#define Unique(V) sort(all(V)),V.erase(unique(all(V)),V.end())

#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long int LL;

typedef pair <int,int> pii;

const int MOD = 1e9 + 7;

const int inf = 1e9;

const double EPS = 1e-9;

const double PI = acos(-1.0);

const long long INF = 1e18;

const int N = 1e5 + 5;



int a[ N ];



int main( ) {

        IO;

        #ifdef LOCAL

            //freopen( "input.txt" , "r" , stdin );

        #endif // LOCAL

        int n;

        cin >> n;

        for( int i = 1; i <= n; i++ ) cin >> a[i];

        sort( a + 1 , a + n + 1 );

        int ans = 0;

        for( int i = 1; i <= 1e5; i++ ) {

                int lo = 1 , hi = n , ret = 0 , key = i;

                while( lo <= hi ) {

                        int mid = ( lo + hi ) >> 1;

                        if( a[mid] >= key ) ret = mid , hi = mid - 1;

                        else if( a[mid] < key ) lo = mid + 1;

                }

                int big = n - ret + 1;

                int small = n - big;

                if( big == small ) ans++;

        }

        cout << ans << endl;

        return 0;

}


















// Faster C++ solution for the same problem (measured speedup: 1.9506733379388066x):
#include<bits/stdc++.h>

#define     sc(a)       scanf("%d",&a)

#define     sc2(a,b)    scanf("%d%d",&a,&b)

#define     line        "\n"

#define     space       " "

#define     MAX         100010

#define     MOD         1000000007

#define     Q           int nn ; scanf("%d",&nn); for (int xx=0;xx<nn;xx++)

#define     ff          first

#define     ss          second

#define     pf(a)       printf("%d\n",a)

#define     pfs(a)      printf("%d ",a)

#define     pf2(a,b)    printf("%d %d\n",a,b)

#define     itm(it)     map<int,int>:: iterator it

#define     its(it)     set<int>:: iterator it

#define     ac_sort(v)  sort(v.begin(),v.end())

#define     dc_sort(v)  sort(v.rbegin(),v.rend())

typedef long long lld;

using namespace std;

int main()

{

    int n ; sc(n);

    int k = n/2;

    int arr[n];

    for (int x=0;x<n;x++) sc(arr[x]);

    sort(arr,arr+n);

    int a = arr[k-1],b=arr[k];

    int c = b-a;

    pf(c);

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



#define trace(...) __f( #__VA_ARGS__ , __VA_ARGS__ )

template <typename Arg1>

void __f( const char* name , Arg1&& arg1 ) {

        cerr << name << " : " << arg1 << "\n";

}

template <typename Arg1, typename... Args>

void __f( const char* na , Arg1&& arg1 , Args&&... args ) {

        const char* c = strchr( na + 1 , ',' );

        cerr.write( na , c - na ) << " : " << arg1 << " , ";

        __f( c + 1 , args... );

}

#define endl "\n"

#define all(V) V.begin(),V.end()

#define Unique(V) sort(all(V)),V.erase(unique(all(V)),V.end())

#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long int LL;

typedef pair <int,int> pii;

const int MOD = 1e9 + 7;

const int inf = 1e9;

const double EPS = 1e-9;

const double PI = acos(-1.0);

const long long INF = 1e18;

const int N = 1e5 + 5;



int a[ N ];



int main( ) {

        IO;

        #ifdef LOCAL

            //freopen( "input.txt" , "r" , stdin );

        #endif // LOCAL

        int n;

        cin >> n;

        for( int i = 1; i <= n; i++ ) cin >> a[i];

        sort( a + 1 , a + n + 1 );

        int ans = 0;

        for( int i = 1; i <= 1e5; i++ ) {

                int lo = 1 , hi = n , ret = 0 , key = i;

                while( lo <= hi ) {

                        int mid = ( lo + hi ) >> 1;

                        if( a[mid] >= key ) ret = mid , hi = mid - 1;

                        else if( a[mid] < key ) lo = mid + 1;

                }

                int big = n - ret + 1;

                int small = n - big;

                if( big == small ) ans++;

        }

        cout << ans << endl;

        return 0;

}


















// Faster C++ solution for the same problem (measured speedup: 1.9188239372725422x):
#include<iostream>

#include<string>

#include<algorithm>

#include<cstdlib>

#include<stack>

#include<queue>

#include<vector>

using namespace std;

int main()

{

	long long int a, b, c, d, i, j, k, m, l, t;

	vector<long long int>v;

	cin >> a;

	for (i = 0; i < a; i++)

	{

		cin >> b;

		v.push_back(b);

	}

	sort(v.begin(), v.end());

	cout << v[a / 2] - v[a / 2 - 1] << endl;

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



#define trace(...) __f( #__VA_ARGS__ , __VA_ARGS__ )

template <typename Arg1>

void __f( const char* name , Arg1&& arg1 ) {

        cerr << name << " : " << arg1 << "\n";

}

template <typename Arg1, typename... Args>

void __f( const char* na , Arg1&& arg1 , Args&&... args ) {

        const char* c = strchr( na + 1 , ',' );

        cerr.write( na , c - na ) << " : " << arg1 << " , ";

        __f( c + 1 , args... );

}

#define endl "\n"

#define all(V) V.begin(),V.end()

#define Unique(V) sort(all(V)),V.erase(unique(all(V)),V.end())

#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long int LL;

typedef pair <int,int> pii;

const int MOD = 1e9 + 7;

const int inf = 1e9;

const double EPS = 1e-9;

const double PI = acos(-1.0);

const long long INF = 1e18;

const int N = 1e5 + 5;



int a[ N ];



int main( ) {

        IO;

        #ifdef LOCAL

            //freopen( "input.txt" , "r" , stdin );

        #endif // LOCAL

        int n;

        cin >> n;

        for( int i = 1; i <= n; i++ ) cin >> a[i];

        sort( a + 1 , a + n + 1 );

        int ans = 0;

        for( int i = 1; i <= 1e5; i++ ) {

                int lo = 1 , hi = n , ret = 0 , key = i;

                while( lo <= hi ) {

                        int mid = ( lo + hi ) >> 1;

                        if( a[mid] >= key ) ret = mid , hi = mid - 1;

                        else if( a[mid] < key ) lo = mid + 1;

                }

                int big = n - ret + 1;

                int small = n - big;

                if( big == small ) ans++;

        }

        cout << ans << endl;

        return 0;

}


















// Faster C++ solution for the same problem (measured speedup: 1.9032166960015091x):
#include<bits/stdc++.h>

#define pii pair<long long int,long long int>

using namespace std;



int main()

{

    int n,i,j;

    cin>>n;

    vector<int>v;

    for(i=0;i<n;i++)

    {

        cin>>j;

        v.push_back(j);

    }

    sort(v.begin(),v.end());

    if(v[n/2]!=v[n/2]- 1){

        cout<<v[n/2]-v[n/2-1]<<endl;

    }

    else{

        cout<<0<<endl;

    }

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



#define trace(...) __f( #__VA_ARGS__ , __VA_ARGS__ )

template <typename Arg1>

void __f( const char* name , Arg1&& arg1 ) {

        cerr << name << " : " << arg1 << "\n";

}

template <typename Arg1, typename... Args>

void __f( const char* na , Arg1&& arg1 , Args&&... args ) {

        const char* c = strchr( na + 1 , ',' );

        cerr.write( na , c - na ) << " : " << arg1 << " , ";

        __f( c + 1 , args... );

}

#define endl "\n"

#define all(V) V.begin(),V.end()

#define Unique(V) sort(all(V)),V.erase(unique(all(V)),V.end())

#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long int LL;

typedef pair <int,int> pii;

const int MOD = 1e9 + 7;

const int inf = 1e9;

const double EPS = 1e-9;

const double PI = acos(-1.0);

const long long INF = 1e18;

const int N = 1e5 + 5;



int a[ N ];



int main( ) {

        IO;

        #ifdef LOCAL

            //freopen( "input.txt" , "r" , stdin );

        #endif // LOCAL

        int n;

        cin >> n;

        for( int i = 1; i <= n; i++ ) cin >> a[i];

        sort( a + 1 , a + n + 1 );

        int ans = 0;

        for( int i = 1; i <= 1e5; i++ ) {

                int lo = 1 , hi = n , ret = 0 , key = i;

                while( lo <= hi ) {

                        int mid = ( lo + hi ) >> 1;

                        if( a[mid] >= key ) ret = mid , hi = mid - 1;

                        else if( a[mid] < key ) lo = mid + 1;

                }

                int big = n - ret + 1;

                int small = n - big;

                if( big == small ) ans++;

        }

        cout << ans << endl;

        return 0;

}


















// Faster C++ solution for the same problem (measured speedup: 1.9263276586657927x):
#include<bits/stdc++.h>

#define ull unsigned long long

#define ll long long

#define pb push_back

#define endl '\n'

#define mod 1000000007

#define mod1 1000000009

#define line cout<<"----------------------"<<endl

#define mp make_pair

#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define filein freopen("input.txt","r",stdin)

#define fileout freopen("output.txt","w",stdout)

using namespace std;

const ll   mx=200009;

ll  ara[mx];

int  main()

{

    ll  n;

    cin>>n;

    for(ll  i=0;i<n;i++) cin>>ara[i];

    sort(ara,ara+n);

    if(n%2) cout<<"0"<<endl;

    else

    {

        ll  ind=n/2;

        if(ara[ind]==ara[ind-1]) cout<<0<<endl;

        else cout<<ara[ind]-ara[ind-1]<<endl;

    }

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



#define trace(...) __f( #__VA_ARGS__ , __VA_ARGS__ )

template <typename Arg1>

void __f( const char* name , Arg1&& arg1 ) {

        cerr << name << " : " << arg1 << "\n";

}

template <typename Arg1, typename... Args>

void __f( const char* na , Arg1&& arg1 , Args&&... args ) {

        const char* c = strchr( na + 1 , ',' );

        cerr.write( na , c - na ) << " : " << arg1 << " , ";

        __f( c + 1 , args... );

}

#define endl "\n"

#define all(V) V.begin(),V.end()

#define Unique(V) sort(all(V)),V.erase(unique(all(V)),V.end())

#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long int LL;

typedef pair <int,int> pii;

const int MOD = 1e9 + 7;

const int inf = 1e9;

const double EPS = 1e-9;

const double PI = acos(-1.0);

const long long INF = 1e18;

const int N = 1e5 + 5;



int a[ N ];



int main( ) {

        IO;

        #ifdef LOCAL

            //freopen( "input.txt" , "r" , stdin );

        #endif // LOCAL

        int n;

        cin >> n;

        for( int i = 1; i <= n; i++ ) cin >> a[i];

        sort( a + 1 , a + n + 1 );

        int ans = 0;

        for( int i = 1; i <= 1e5; i++ ) {

                int lo = 1 , hi = n , ret = 0 , key = i;

                while( lo <= hi ) {

                        int mid = ( lo + hi ) >> 1;

                        if( a[mid] >= key ) ret = mid , hi = mid - 1;

                        else if( a[mid] < key ) lo = mid + 1;

                }

                int big = n - ret + 1;

                int small = n - big;

                if( big == small ) ans++;

        }

        cout << ans << endl;

        return 0;

}


















// Faster C++ solution for the same problem (measured speedup: 1.8973514150090056x):
#include<bits/stdc++.h>



using namespace std;



int main()

{

    int n;

    cin>>n;

    vector<int>v1;

    set<int>s1;

    for(int i=0; i<n; i++)

    {

        int x;

        cin>>x;

        v1.push_back(x);

        s1.insert(x);

    }

  

    sort(v1.begin(),v1.end());

    int m=n/2;

    cout<<v1[m]-v1[m-1]<<endl;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



#define trace(...) __f( #__VA_ARGS__ , __VA_ARGS__ )

template <typename Arg1>

void __f( const char* name , Arg1&& arg1 ) {

        cerr << name << " : " << arg1 << "\n";

}

template <typename Arg1, typename... Args>

void __f( const char* na , Arg1&& arg1 , Args&&... args ) {

        const char* c = strchr( na + 1 , ',' );

        cerr.write( na , c - na ) << " : " << arg1 << " , ";

        __f( c + 1 , args... );

}

#define endl "\n"

#define all(V) V.begin(),V.end()

#define Unique(V) sort(all(V)),V.erase(unique(all(V)),V.end())

#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long int LL;

typedef pair <int,int> pii;

const int MOD = 1e9 + 7;

const int inf = 1e9;

const double EPS = 1e-9;

const double PI = acos(-1.0);

const long long INF = 1e18;

const int N = 1e5 + 5;



int a[ N ];



int main( ) {

        IO;

        #ifdef LOCAL

            //freopen( "input.txt" , "r" , stdin );

        #endif // LOCAL

        int n;

        cin >> n;

        for( int i = 1; i <= n; i++ ) cin >> a[i];

        sort( a + 1 , a + n + 1 );

        int ans = 0;

        for( int i = 1; i <= 1e5; i++ ) {

                int lo = 1 , hi = n , ret = 0 , key = i;

                while( lo <= hi ) {

                        int mid = ( lo + hi ) >> 1;

                        if( a[mid] >= key ) ret = mid , hi = mid - 1;

                        else if( a[mid] < key ) lo = mid + 1;

                }

                int big = n - ret + 1;

                int small = n - big;

                if( big == small ) ans++;

        }

        cout << ans << endl;

        return 0;

}


















// Faster C++ solution for the same problem (measured speedup: 1.904013321330442x):
#include<bits/stdc++.h>

#define ll long long int

using namespace std;

 int main()

 {



     int n;

     cin>>n;

     vector<int>v;

     for(int i=0;i<n;i++)

     {

         int x;

         cin>>x;

         v.push_back(x);

     }

     sort(v.begin(),v.end());



         int u=(n/2)-1;

         if(v[u]==v[u+1])

         {

             cout<<"0"<<endl;



         }

         else

         {

             int ans=v[u+1]-v[u];

             cout<<ans<<endl;

         }





 }
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



#define trace(...) __f( #__VA_ARGS__ , __VA_ARGS__ )

template <typename Arg1>

void __f( const char* name , Arg1&& arg1 ) {

        cerr << name << " : " << arg1 << "\n";

}

template <typename Arg1, typename... Args>

void __f( const char* na , Arg1&& arg1 , Args&&... args ) {

        const char* c = strchr( na + 1 , ',' );

        cerr.write( na , c - na ) << " : " << arg1 << " , ";

        __f( c + 1 , args... );

}

#define endl "\n"

#define all(V) V.begin(),V.end()

#define Unique(V) sort(all(V)),V.erase(unique(all(V)),V.end())

#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long int LL;

typedef pair <int,int> pii;

const int MOD = 1e9 + 7;

const int inf = 1e9;

const double EPS = 1e-9;

const double PI = acos(-1.0);

const long long INF = 1e18;

const int N = 1e5 + 5;



int a[ N ];



int main( ) {

        IO;

        #ifdef LOCAL

            //freopen( "input.txt" , "r" , stdin );

        #endif // LOCAL

        int n;

        cin >> n;

        for( int i = 1; i <= n; i++ ) cin >> a[i];

        sort( a + 1 , a + n + 1 );

        int ans = 0;

        for( int i = 1; i <= 1e5; i++ ) {

                int lo = 1 , hi = n , ret = 0 , key = i;

                while( lo <= hi ) {

                        int mid = ( lo + hi ) >> 1;

                        if( a[mid] >= key ) ret = mid , hi = mid - 1;

                        else if( a[mid] < key ) lo = mid + 1;

                }

                int big = n - ret + 1;

                int small = n - big;

                if( big == small ) ans++;

        }

        cout << ans << endl;

        return 0;

}


















// Faster C++ solution for the same problem (measured speedup: 1.9032091197113106x):
#include<bits/stdc++.h>

using namespace std;



int main()

{

    int n;

    cin>>n;

    vector<int>v;

    for(int i=0;i<n;i++)

    {

        int x;

        cin>>x;

        v.push_back(x);

    }

    sort(v.begin(),v.end());

    n/=2;

    cout<<v[n]-v[n-1]<<endl;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



#define trace(...) __f( #__VA_ARGS__ , __VA_ARGS__ )

template <typename Arg1>

void __f( const char* name , Arg1&& arg1 ) {

        cerr << name << " : " << arg1 << "\n";

}

template <typename Arg1, typename... Args>

void __f( const char* na , Arg1&& arg1 , Args&&... args ) {

        const char* c = strchr( na + 1 , ',' );

        cerr.write( na , c - na ) << " : " << arg1 << " , ";

        __f( c + 1 , args... );

}

#define endl "\n"

#define all(V) V.begin(),V.end()

#define Unique(V) sort(all(V)),V.erase(unique(all(V)),V.end())

#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long int LL;

typedef pair <int,int> pii;

const int MOD = 1e9 + 7;

const int inf = 1e9;

const double EPS = 1e-9;

const double PI = acos(-1.0);

const long long INF = 1e18;

const int N = 1e5 + 5;



int a[ N ];



int main( ) {

        IO;

        #ifdef LOCAL

            //freopen( "input.txt" , "r" , stdin );

        #endif // LOCAL

        int n;

        cin >> n;

        for( int i = 1; i <= n; i++ ) cin >> a[i];

        sort( a + 1 , a + n + 1 );

        int ans = 0;

        for( int i = 1; i <= 1e5; i++ ) {

                int lo = 1 , hi = n , ret = 0 , key = i;

                while( lo <= hi ) {

                        int mid = ( lo + hi ) >> 1;

                        if( a[mid] >= key ) ret = mid , hi = mid - 1;

                        else if( a[mid] < key ) lo = mid + 1;

                }

                int big = n - ret + 1;

                int small = n - big;

                if( big == small ) ans++;

        }

        cout << ans << endl;

        return 0;

}


















// Faster C++ solution for the same problem (measured speedup: 1.9214661850999184x):
#include <bits/stdc++.h>

#include<cmath>

#include<cstring>

#define pb push_back

#define pi acos(-1.0)

#define loop(i,a,n) for(int i=a;i<n;i++)

#define rloop(i,a,n) for(int i=n;i>=a;i--)

#define ff first

#define ss second

#define sc1(a) scanf("%d",&a)

#define sc2(a,b) scanf("%d %d",&a,&b)

#define sc3(a,b,c) scanf("%d %d %d",&a,&b,&c)

#define ll long long int

#define gcd(a,b) __gcd(a,b)

#define lcm(a,b) (a*b)/(gcd(a,b))

#define ms(a,b) memset(a,b,sizeof a)

#define check cout<<"HI"<<endl;



using namespace std;



int main()

{

    int n,a;

    sc1(n);

    vector<int>v;

    loop(i,0,n)

    {

        sc1(a);

        v.pb(a);

    }

    sort(v.begin(),v.end());

    n=n/2;

    cout<<v[n]-v[n-1]<<endl;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



#define trace(...) __f( #__VA_ARGS__ , __VA_ARGS__ )

template <typename Arg1>

void __f( const char* name , Arg1&& arg1 ) {

        cerr << name << " : " << arg1 << "\n";

}

template <typename Arg1, typename... Args>

void __f( const char* na , Arg1&& arg1 , Args&&... args ) {

        const char* c = strchr( na + 1 , ',' );

        cerr.write( na , c - na ) << " : " << arg1 << " , ";

        __f( c + 1 , args... );

}

#define endl "\n"

#define all(V) V.begin(),V.end()

#define Unique(V) sort(all(V)),V.erase(unique(all(V)),V.end())

#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long int LL;

typedef pair <int,int> pii;

const int MOD = 1e9 + 7;

const int inf = 1e9;

const double EPS = 1e-9;

const double PI = acos(-1.0);

const long long INF = 1e18;

const int N = 1e5 + 5;



int a[ N ];



int main( ) {

        IO;

        #ifdef LOCAL

            //freopen( "input.txt" , "r" , stdin );

        #endif // LOCAL

        int n;

        cin >> n;

        for( int i = 1; i <= n; i++ ) cin >> a[i];

        sort( a + 1 , a + n + 1 );

        int ans = 0;

        for( int i = 1; i <= 1e5; i++ ) {

                int lo = 1 , hi = n , ret = 0 , key = i;

                while( lo <= hi ) {

                        int mid = ( lo + hi ) >> 1;

                        if( a[mid] >= key ) ret = mid , hi = mid - 1;

                        else if( a[mid] < key ) lo = mid + 1;

                }

                int big = n - ret + 1;

                int small = n - big;

                if( big == small ) ans++;

        }

        cout << ans << endl;

        return 0;

}


















// Faster C++ solution for the same problem (measured speedup: 1.9275193774399833x):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int n,c=0;

    cin>>n;

    int a[n];

    for(int i=0;i<n;i++)

    {

        cin>>a[i];

    }

    sort(a,a+n);

    int x=(n-1)/2;

    int y=x+1;

    cout<<a[y]-a[x];

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



#define trace(...) __f( #__VA_ARGS__ , __VA_ARGS__ )

template <typename Arg1>

void __f( const char* name , Arg1&& arg1 ) {

        cerr << name << " : " << arg1 << "\n";

}

template <typename Arg1, typename... Args>

void __f( const char* na , Arg1&& arg1 , Args&&... args ) {

        const char* c = strchr( na + 1 , ',' );

        cerr.write( na , c - na ) << " : " << arg1 << " , ";

        __f( c + 1 , args... );

}

#define endl "\n"

#define all(V) V.begin(),V.end()

#define Unique(V) sort(all(V)),V.erase(unique(all(V)),V.end())

#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long int LL;

typedef pair <int,int> pii;

const int MOD = 1e9 + 7;

const int inf = 1e9;

const double EPS = 1e-9;

const double PI = acos(-1.0);

const long long INF = 1e18;

const int N = 1e5 + 5;



int a[ N ];



int main( ) {

        IO;

        #ifdef LOCAL

            //freopen( "input.txt" , "r" , stdin );

        #endif // LOCAL

        int n;

        cin >> n;

        for( int i = 1; i <= n; i++ ) cin >> a[i];

        sort( a + 1 , a + n + 1 );

        int ans = 0;

        for( int i = 1; i <= 1e5; i++ ) {

                int lo = 1 , hi = n , ret = 0 , key = i;

                while( lo <= hi ) {

                        int mid = ( lo + hi ) >> 1;

                        if( a[mid] >= key ) ret = mid , hi = mid - 1;

                        else if( a[mid] < key ) lo = mid + 1;

                }

                int big = n - ret + 1;

                int small = n - big;

                if( big == small ) ans++;

        }

        cout << ans << endl;

        return 0;

}


















// Faster C++ solution for the same problem (measured speedup: 1.9027338540520178x):
///*****************************************************///

///*.......................Shadman Sakib Utshob............................*///

///*...................................................................*///

///*.........................................*///

///*...................................................*///

///*****************************************************///



#include <bits/stdc++.h>

using namespace std;



#define Boost      ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)

#define pb          push_back

#define inf         1e9+8

#define mp          make_pair

#define rep(i,n)    for(int i=0;i<n;i++)

#define repo(i,a,n) for(int i=a;i<=n;i++)

#define ll          long long

#define pii         pair<ll,ll >

#define MOD         1000000007

#define fileout     freopen("output.txt","w",stdout)

#define mem(x,i)    memset(x,i,sizeof x)

#define PI          acos(-1.0)

#define ff          first

#define ss          second

#define T          int t;cin>>t;while(t--)



int main()

{

    Boost;



    int n,i=0,x,y;

    cin>>n;

    int d[n+1];

    rep(i,n)

    {

        cin>>d[i];

    }

    sort(d,d+n);

    //cout<<d[3]<<endl;

    x=d[((n-1)/2)+1];

    y=d[(n-1)/2];

    //cout<<x<<y<<endl;

    cout<<x-y<<endl;





}