stablegradients/pie-gem5-pairs huggingface dataset:
// 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.171383818093047x):
#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: 1.9608605267612254x):
#include<bits/stdc++.h>

using namespace std;

const int maxn=1e5+10;

const int mod=1e6+3;

typedef long long ll;

#define inf 0x3f3f3f3f

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

#define per(i,a,b) for(int i=(a);i<b;i++)

#define rep(i,a,b) for(int i=(a);i<=b;i++)

#define pi acos(-1.0)

#define mid ((l+r)>>1)

#define lson rt<<1,l,mid

#define rson rt<<1|1,mid+1,r

void read(int &x)

{

	int f=1;x=0;

	char ch=getchar();

	while(ch<'0'||ch>'9')

	{

		if(ch=='-')f=-1;

		ch=getchar();

	}

	while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();

	x*=f;

}

int a[maxn];

int main()

{

	int n;

	read(n);

	int ans=0;

	rep(i,1,n)read(a[i]);

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

	int x=a[n/2],y=a[n/2+1];

	ans=y-x;

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

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

#include<algorithm>

using namespace std;

int main(){

	int n,k;

	int a[100005];

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

		k=0;

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

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

		sort(a,a+n);

		if(a[n/2-1]<a[n/2])

		k=a[n/2]-a[n/2-1];

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

	} 

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

#include<algorithm>

using namespace std;

int main(){

	int n,k;

	int a[100005];

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

		k=0;

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

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

		sort(a,a+n);

		if(a[n/2-1]<a[n/2])

		k=a[n/2]-a[n/2-1];

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

	} 

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

#include<algorithm>

using namespace std;

int main(){

	int n,k;

	int a[100005];

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

		k=0;

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

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

		sort(a,a+n);

		if(a[n/2-1]<a[n/2])

		k=a[n/2]-a[n/2-1];

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

	} 

return 0;	

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

#include<algorithm>

using namespace std;

int main(){

	int n,k;

	int a[100005];

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

		k=0;

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

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

		sort(a,a+n);

		if(a[n/2-1]<a[n/2])

		k=a[n/2]-a[n/2-1];

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

	} 

return 0;	

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

using namespace std;

const int maxn=1e5+10;

const int mod=1e6+3;

typedef long long ll;

#define inf 0x3f3f3f3f

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

#define per(i,a,b) for(int i=(a);i<b;i++)

#define rep(i,a,b) for(int i=(a);i<=b;i++)

#define pi acos(-1.0)

#define mid ((l+r)>>1)

#define lson rt<<1,l,mid

#define rson rt<<1|1,mid+1,r

void read(int &x)

{

	int f=1;x=0;

	char ch=getchar();

	while(ch<'0'||ch>'9')

	{

		if(ch=='-')f=-1;

		ch=getchar();

	}

	while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();

	x*=f;

}

int a[maxn];

int main()

{

	int n;

	read(n);

	int ans=0;

	rep(i,1,n)read(a[i]);

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

	int x=a[n/2],y=a[n/2+1];

	ans=y-x;

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

}

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

#include<algorithm>

using namespace std;

int main(){

	int n,k;

	int a[100005];

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

		k=0;

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

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

		sort(a,a+n);

		if(a[n/2-1]<a[n/2])

		k=a[n/2]-a[n/2-1];

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

	} 

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: 1.695712745523679x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int main(){

	int n;

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

		int a[100005]={0};

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

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

		}

		sort(a,a+n);

		int r=n/2,l=r-1;

		int ans=a[r]-a[l];

//		printf("%d %d\n",a[l],a[r]);

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

	}

	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: 3.2618919055093536x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int main(){

	int n;

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

		int a[100005]={0};

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

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

		}

		sort(a,a+n);

		int r=n/2,l=r-1;

		int ans=a[r]-a[l];

//		printf("%d %d\n",a[l],a[r]);

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

	}

	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: 1.7156237082284982x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int main(){

	int n;

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

		int a[100005]={0};

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

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

		}

		sort(a,a+n);

		int r=n/2,l=r-1;

		int ans=a[r]-a[l];

//		printf("%d %d\n",a[l],a[r]);

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

	}

	return 0;

}
// 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: 1.6850394610740393x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int main(){

	int n;

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

		int a[100005]={0};

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

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

		}

		sort(a,a+n);

		int r=n/2,l=r-1;

		int ans=a[r]-a[l];

//		printf("%d %d\n",a[l],a[r]);

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

	}

	return 0;

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

using namespace std;

const int maxn=1e5+10;

const int mod=1e6+3;

typedef long long ll;

#define inf 0x3f3f3f3f

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

#define per(i,a,b) for(int i=(a);i<b;i++)

#define rep(i,a,b) for(int i=(a);i<=b;i++)

#define pi acos(-1.0)

#define mid ((l+r)>>1)

#define lson rt<<1,l,mid

#define rson rt<<1|1,mid+1,r

void read(int &x)

{

	int f=1;x=0;

	char ch=getchar();

	while(ch<'0'||ch>'9')

	{

		if(ch=='-')f=-1;

		ch=getchar();

	}

	while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();

	x*=f;

}

int a[maxn];

int main()

{

	int n;

	read(n);

	int ans=0;

	rep(i,1,n)read(a[i]);

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

	int x=a[n/2],y=a[n/2+1];

	ans=y-x;

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

}

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

#include<cstring>

#include<algorithm>

using namespace std;

int main(){

	int n;

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

		int a[100005]={0};

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

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

		}

		sort(a,a+n);

		int r=n/2,l=r-1;

		int ans=a[r]-a[l];

//		printf("%d %d\n",a[l],a[r]);

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

	}

	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.9521140993807728x):
#include <bits/stdc++.h>



using namespace std;

const int N = 1e5 + 5;

int arr[N];



int main() {

    // freopen("in.txt", "rt", stdin);

    int n;

    scanf("%d", &n);

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

        scanf("%d", arr + i);

    }

    sort(arr, arr + n);

    int j = n / 2, i = j - 1;

    printf("%d", arr[j] - arr[i]);

}