stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <cstdio>

#include <iostream>

#include <string>

#include <vector>

#include <sstream>

#include <map>

#include <set>

#include <queue>

#include <algorithm>

#include <cmath>

#include <cstring>

#include <typeinfo>

#include <numeric>

#include <functional>

#include <unordered_map>

#include <bitset>

#include <stack>

#include <assert.h>

#include <unordered_set>

#include <random>







using namespace std;

using ll = long long;

using ull = unsigned long long;



const ll INF = 1e16;

const ll MOD = 1e9 + 7;



#define REP(i, n) for(ll i = 0; i < n; i++)





















int main(){

    ll n;

    cin >> n;

    vector<ll> d(n);

    REP(i, n){

        cin >> d[i];

    }

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

    ll ans = 0;

    for(ll k = 1; k <= 100000; k++){

        ll itr = lower_bound(d.begin(), d.end(), k) - d.begin();

        if(itr == n / 2) ans++;

    }

    cout << ans << endl;

}

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

#include <iostream>

#include <string>

#include <vector>

#include <sstream>

#include <map>

#include <set>

#include <queue>

#include <algorithm>

#include <cmath>

#include <cstring>

#include <typeinfo>

#include <numeric>

#include <functional>

#include <unordered_map>

#include <bitset>

#include <stack>

#include <assert.h>

#include <unordered_set>

#include <random>





using namespace std;

using ll = long long;

using ull = unsigned long long;



const ll INF = 1e18;

const ll MOD = 1e9 + 7;



#define REP(i, n) for(ll i = 0; i < n; i++)







































int main(){

    ll n;

    cin >> n;

    vector<ll> d(n);

    REP(i, n){

        cin >> d[i];

    }

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

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

}
// Slower C++ solution:
#include <iostream>

#include <vector>

#include <climits>

#include <algorithm>

#include <cmath>

#include <map>

#include <set>

#include <string>

#include <bitset>

#include <utility>

#include <numeric>

#include <queue>

#include <stack>



using ll = long long;

using namespace std;



constexpr int MOD = 1e9 + 7;

constexpr ll MOD_LL = ll(1e9 + 7);



int main(void) {

	int n;

	cin >> n;

	

	vector<int> d(n);

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

		cin >> d[i];

	}

	

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

	

	int ans = 0;

	for(int i = 1; i <= d.back(); ++i) {

		int x = lower_bound(d.begin(), d.end(), i) - d.begin();

		

		if( x == n / 2 ) ans++;

	}

	

	cout << ans << endl;

	

	return 0;

}


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

#include <vector>

#include <climits>

#include <algorithm>

#include <cmath>

#include <map>

#include <set>

#include <string>

#include <bitset>

#include <utility>

#include <numeric>

#include <queue>

#include <stack>



using ll = long long;

using namespace std;



constexpr int MOD = 1e9 + 7;

constexpr ll MOD_LL = ll(1e9 + 7);



int main(void) {

	int n;

	cin >> n;

	

	vector<int> d(n);

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

		cin >> d[i];

	}

	

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

	

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

	

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<iomanip>

#include<cmath>

#include<string>

#include<cstring>

#include<vector>

#include<list>

#include<algorithm>

#include<map>

#include<set>

#include<queue>

#include<stack>

using namespace std;

typedef long long ll;

#define fi first

#define se second

#define mp make_pair

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

#define rrep(i, n) for(int i=n;i>=0;--i)

const int inf=1e9+7;

const ll mod=1e9+7;

const ll big=1e18;

const double PI=2*asin(1);



int main() {

  int N;

  cin>>N;

  vector<int> d(N);

  for(int i=0;i<N;++i) cin>>d[i];

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

  int ans = 0;

  int index;

  for(int k=0;k<=100005;++k) {

    index = lower_bound(d.begin(), d.end(), k) - d.begin();

    if(index==N/2) ans++;

  }

  cout<<ans<<endl;

}




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

#include<iomanip>

#include<cmath>

#include<string>

#include<cstring>

#include<vector>

#include<list>

#include<algorithm>

#include<map>

#include<set>

#include<queue>

#include<stack>

using namespace std;

typedef long long ll;

#define fi first

#define se second

#define mp make_pair

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

#define rrep(i, n) for(int i=n;i>=0;--i)

const int inf=1e9+7;

const ll mod=1e9+7;

const ll big=1e18;

const double PI=2*asin(1);



int main() {

  int N;

  cin>>N;

  vector<int> d(N);

  for(int i=0;i<N;++i) cin>>d[i];

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

  cout<<d[N/2]-d[N/2-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.9012863309504424x):
#include <iostream>

#include <string>

#include <iomanip>

#include <cmath>

#include <vector>

#include <set>

#include <map>

#include <algorithm>





typedef long long ll;

typedef unsigned long long ull;



using namespace std;



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



int main() {

	drobucs;

	

	int n;

	cin >> n;



	vector<int> v(n);



	for (auto &t : v) {

		cin >> t;

	}



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



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



	return 0;

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

#define me(a,x) memset(a,x,sizeof(a))

#define sc scanf

#define itn int

using namespace std;

const int N=1e6;

const long long mod=1e9+7;

const int oo=0x7fffffff;

const int sup=0x80000000;

typedef long long ll;

typedef unsigned long long ull;

template <typename it>void db(it *begin,it *end){while(begin!=end)cout<<(*begin++)<<" ";puts("");}

template <typename it>

string to_str(it n){string s="";while(n)s+=n%10+'0',n/=10;reverse(s.begin(),s.end());return s;}

template <typename it>int o(it a){cout<<a<<endl;return 0;}

ll mul(ll a,ll b,ll c){ll ans=0;for(;b;b>>=1,a=(a+a)%c)if(b&1)ans=(ans+a)%c;return ans;}

ll ksm(ll a,ll b,ll c){ll ans=1;for(;b;b>>=1,a=mul(a,a,c))if(b&1)ans=mul(ans,a,c);return ans;}

int n,d[N];

int main(){

	cin>>n;

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

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

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

}

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

#include<algorithm>

using namespace std;

int a[100005]={0};

int main()

{

	int n;

	while(~scanf("%d",&n))

	{

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

		scanf("%d",&a[i]);

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

		if(a[n/2]==a[n/2+1]) 

		printf("0\n");

		else

		printf("%d\n",a[n/2+1]-a[n/2]);

	}

 }
// 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: 9.99961968427004x):
#include<stdio.h>

#include<algorithm>

using namespace std;

int a[100005]={0};

int main()

{

	int n;

	while(~scanf("%d",&n))

	{

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

		scanf("%d",&a[i]);

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

		if(a[n/2]==a[n/2+1]) 

		printf("0\n");

		else

		printf("%d\n",a[n/2+1]-a[n/2]);

	}

 }
// Slower C++ solution:
#include <iostream>

#include <string>

#include <iomanip>

#include <cmath>

#include <vector>

#include <set>

#include <map>

#include <algorithm>





typedef long long ll;

typedef unsigned long long ull;



using namespace std;



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



int main() {

	drobucs;

	

	int n;

	cin >> n;



	vector<int> v(n);



	for (auto &t : v) {

		cin >> t;

	}



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



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



	return 0;

}

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

#include<algorithm>

using namespace std;

int a[100005]={0};

int main()

{

	int n;

	while(~scanf("%d",&n))

	{

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

		scanf("%d",&a[i]);

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

		if(a[n/2]==a[n/2+1]) 

		printf("0\n");

		else

		printf("%d\n",a[n/2+1]-a[n/2]);

	}

 }
// Slower C++ solution:
#define mod 1000000007

#define PI acos(-1)

#include<time.h>

#include<stdio.h>

#include<string.h>

#include<math.h>

#include<map>

#include<queue>

#include<iostream>

#include<vector>

#include<algorithm>

using namespace std;

typedef long long ll;

const ll INF=0x7fffffffffffffff;

const int inf=0x7fffffff;

const int N=1e5+5;

clock_t start,finish;

void time_in(){start=clock();}

void time_out(){finish=clock();double tim=(double)(finish-start)/CLOCKS_PER_SEC;printf("Running time is %lf\n",tim);}

inline ll mul(ll a,ll b){ll s=0;while(b){if(b&1)s=(s+a)%mod;a=(a<<1)%mod;b>>=1;}return s%mod;}

inline ll pow_mul(ll a,ll b){ll s=1;while(b){if(b&1)s=mul(s,a);a=mul(a,a);b>>=1;}return s;}

inline ll poww(ll a,ll b){ll s=1;while(b){if(b&1)s=(s*a)%mod;a=(a*a)%mod;b>>=1;}return s%mod;}

inline bool read(int &ret){char c=getchar();int sgn;if(c==EOF)return 0;while(c!='-'&&(c<'0'||c>'9'))c=getchar();

	sgn=((c=='-')?-1:1);ret=((c=='-')?0:(c-'0'));while(c=getchar(),c>='0'&&c<='9')ret=ret*10+(c-'0');ret*=sgn;return 1;}

inline void write(int x){if(x>9)write(x/10);putchar(x%10+'0');}

int fact[10]={1,1,2,6,24,120,720,5040,40320,362880};

int st[4][2]={1,0,0,1,-1,0,0,-1};

//vector<int>vt[N];

//priority_queue<int>q;

int t,cas;

int n,m,k;

int main()

{

	int a[N];

	while(~scanf("%d",&n))

	{

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

		{

			scanf("%d",&a[i]);

		}

		if(n&1)

		{printf("0\n");continue;}

		sort(a,a+n);

		int x=n>>1;

		if(a[x]>a[x-1])

		{

			printf("%d\n",a[x]-a[x-1]);

		}

		else printf("0\n");

	}

}


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

#include<algorithm>

using namespace std;

int a[100005]={0};

int main()

{

	int n;

	while(~scanf("%d",&n))

	{

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

		scanf("%d",&a[i]);

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

		if(a[n/2]==a[n/2+1]) 

		printf("0\n");

		else

		printf("%d\n",a[n/2+1]-a[n/2]);

	}

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

#define me(a,x) memset(a,x,sizeof(a))

#define sc scanf

#define itn int

using namespace std;

const int N=1e6;

const long long mod=1e9+7;

const int oo=0x7fffffff;

const int sup=0x80000000;

typedef long long ll;

typedef unsigned long long ull;

template <typename it>void db(it *begin,it *end){while(begin!=end)cout<<(*begin++)<<" ";puts("");}

template <typename it>

string to_str(it n){string s="";while(n)s+=n%10+'0',n/=10;reverse(s.begin(),s.end());return s;}

template <typename it>int o(it a){cout<<a<<endl;return 0;}

ll mul(ll a,ll b,ll c){ll ans=0;for(;b;b>>=1,a=(a+a)%c)if(b&1)ans=(ans+a)%c;return ans;}

ll ksm(ll a,ll b,ll c){ll ans=1;for(;b;b>>=1,a=mul(a,a,c))if(b&1)ans=mul(ans,a,c);return ans;}

int n,d[N];

int main(){

	cin>>n;

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

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

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

}

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

#include<algorithm>

using namespace std; 

int a[100010];

int main()

{

	int n,i;

	scanf("%d",&n);

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

	scanf("%d",&a[i]);

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

	if(n%2!=0) printf("0\n");

	else

	{

		int m=n/2;

		m=a[m+1]-a[m];

		printf("%d\n",m);

	}



}
// 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: 10.002490387457213x):
#include<stdio.h>

#include<algorithm>

using namespace std; 

int a[100010];

int main()

{

	int n,i;

	scanf("%d",&n);

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

	scanf("%d",&a[i]);

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

	if(n%2!=0) printf("0\n");

	else

	{

		int m=n/2;

		m=a[m+1]-a[m];

		printf("%d\n",m);

	}



}
// Slower C++ solution:
#include <iostream>

#include <string>

#include <iomanip>

#include <cmath>

#include <vector>

#include <set>

#include <map>

#include <algorithm>





typedef long long ll;

typedef unsigned long long ull;



using namespace std;



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



int main() {

	drobucs;

	

	int n;

	cin >> n;



	vector<int> v(n);



	for (auto &t : v) {

		cin >> t;

	}



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



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



	return 0;

}

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

#include<algorithm>

using namespace std; 

int a[100010];

int main()

{

	int n,i;

	scanf("%d",&n);

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

	scanf("%d",&a[i]);

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

	if(n%2!=0) printf("0\n");

	else

	{

		int m=n/2;

		m=a[m+1]-a[m];

		printf("%d\n",m);

	}



}
// Slower C++ solution:
#define mod 1000000007

#define PI acos(-1)

#include<time.h>

#include<stdio.h>

#include<string.h>

#include<math.h>

#include<map>

#include<queue>

#include<iostream>

#include<vector>

#include<algorithm>

using namespace std;

typedef long long ll;

const ll INF=0x7fffffffffffffff;

const int inf=0x7fffffff;

const int N=1e5+5;

clock_t start,finish;

void time_in(){start=clock();}

void time_out(){finish=clock();double tim=(double)(finish-start)/CLOCKS_PER_SEC;printf("Running time is %lf\n",tim);}

inline ll mul(ll a,ll b){ll s=0;while(b){if(b&1)s=(s+a)%mod;a=(a<<1)%mod;b>>=1;}return s%mod;}

inline ll pow_mul(ll a,ll b){ll s=1;while(b){if(b&1)s=mul(s,a);a=mul(a,a);b>>=1;}return s;}

inline ll poww(ll a,ll b){ll s=1;while(b){if(b&1)s=(s*a)%mod;a=(a*a)%mod;b>>=1;}return s%mod;}

inline bool read(int &ret){char c=getchar();int sgn;if(c==EOF)return 0;while(c!='-'&&(c<'0'||c>'9'))c=getchar();

	sgn=((c=='-')?-1:1);ret=((c=='-')?0:(c-'0'));while(c=getchar(),c>='0'&&c<='9')ret=ret*10+(c-'0');ret*=sgn;return 1;}

inline void write(int x){if(x>9)write(x/10);putchar(x%10+'0');}

int fact[10]={1,1,2,6,24,120,720,5040,40320,362880};

int st[4][2]={1,0,0,1,-1,0,0,-1};

//vector<int>vt[N];

//priority_queue<int>q;

int t,cas;

int n,m,k;

int main()

{

	int a[N];

	while(~scanf("%d",&n))

	{

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

		{

			scanf("%d",&a[i]);

		}

		if(n&1)

		{printf("0\n");continue;}

		sort(a,a+n);

		int x=n>>1;

		if(a[x]>a[x-1])

		{

			printf("%d\n",a[x]-a[x-1]);

		}

		else printf("0\n");

	}

}


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

#include<algorithm>

using namespace std; 

int a[100010];

int main()

{

	int n,i;

	scanf("%d",&n);

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

	scanf("%d",&a[i]);

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

	if(n%2!=0) printf("0\n");

	else

	{

		int m=n/2;

		m=a[m+1]-a[m];

		printf("%d\n",m);

	}



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

#define me(a,x) memset(a,x,sizeof(a))

#define sc scanf

#define itn int

using namespace std;

const int N=1e6;

const long long mod=1e9+7;

const int oo=0x7fffffff;

const int sup=0x80000000;

typedef long long ll;

typedef unsigned long long ull;

template <typename it>void db(it *begin,it *end){while(begin!=end)cout<<(*begin++)<<" ";puts("");}

template <typename it>

string to_str(it n){string s="";while(n)s+=n%10+'0',n/=10;reverse(s.begin(),s.end());return s;}

template <typename it>int o(it a){cout<<a<<endl;return 0;}

ll mul(ll a,ll b,ll c){ll ans=0;for(;b;b>>=1,a=(a+a)%c)if(b&1)ans=(ans+a)%c;return ans;}

ll ksm(ll a,ll b,ll c){ll ans=1;for(;b;b>>=1,a=mul(a,a,c))if(b&1)ans=mul(ans,a,c);return ans;}

int n,d[N];

int main(){

	cin>>n;

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

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

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

}

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

#include<algorithm>

using namespace std;

long long int d[1000000];

int main()

{

	long long int n;

	scanf("%ld",&n);

	for(long long int i=1;i<=n;i++)

	scanf("%ld",&d[i]);

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

	long long int m,p;

	m=n/2+1;

	p=n/2;

	printf("%ld\n",d[m]-d[p]);

	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: 10.01074182901796x):
#include<stdio.h>

#include<algorithm>

using namespace std;

long long int d[1000000];

int main()

{

	long long int n;

	scanf("%ld",&n);

	for(long long int i=1;i<=n;i++)

	scanf("%ld",&d[i]);

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

	long long int m,p;

	m=n/2+1;

	p=n/2;

	printf("%ld\n",d[m]-d[p]);

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <string>

#include <iomanip>

#include <cmath>

#include <vector>

#include <set>

#include <map>

#include <algorithm>





typedef long long ll;

typedef unsigned long long ull;



using namespace std;



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



int main() {

	drobucs;

	

	int n;

	cin >> n;



	vector<int> v(n);



	for (auto &t : v) {

		cin >> t;

	}



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



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



	return 0;

}

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

#include<algorithm>

using namespace std;

long long int d[1000000];

int main()

{

	long long int n;

	scanf("%ld",&n);

	for(long long int i=1;i<=n;i++)

	scanf("%ld",&d[i]);

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

	long long int m,p;

	m=n/2+1;

	p=n/2;

	printf("%ld\n",d[m]-d[p]);

	return 0;

}