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

//#include <ext/pb_ds/assoc_container.hpp>

//#include <ext/pb_ds/tree_policy.hpp>

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

#define pb          push_back

#define inf         2e9+5

#define mp          make_pair

#define ll          long long

#define pii         pair<int,int >

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

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

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

#define PI          acos(-1.0)

#define ff          first

#define ss          second

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

#define Case(t)     for(int ks=1;ks<=t;ks++)

#define sf          scanf

#define pf          printf

/*------------------------------Graph Moves----------------------------*/

const int fx[]= {+1,-1,+0,+0};

const int fy[]= {+0,+0,+1,-1};

//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move

//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move

//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move

//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move

/*---------------------------------------------------------------------*/

using namespace std;

//using namespace __gnu_pbds;

//

//template <typename T>  using orderedSet =

//    tree<T, null_type, less<T>,

//    rb_tree_tag, tree_order_statistics_node_update>;//find_by_order,order_of_key

//

int n;

int arr[100005];

void solve()

{

    cin>>n;

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

        cin>>arr[i];

    sort(arr,arr+n);

    int ans=0;

    for(int i=0;i<=arr[n-1] ;i++)

    {

        int x=upper_bound(arr,arr+n,i)-arr;

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

    }

    cout<<ans<<endl;

}



int main()

{

    solve();

}


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

#define ll long long int

using namespace std;

int main()

{

    int n;

    cin>>n;

    int a[n];

    set<int>s;

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

    {

        cin>>a[i];

    }

    sort(a,a+n);

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

    else cout<< a[n/2]-a[n/2-1];

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

//#include <ext/pb_ds/assoc_container.hpp>

//#include <ext/pb_ds/tree_policy.hpp>

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

#define pb          push_back

#define inf         2e9+5

#define mp          make_pair

#define ll          long long

#define pii         pair<int,int >

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

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

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

#define PI          acos(-1.0)

#define ff          first

#define ss          second

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

#define Case(t)     for(int ks=1;ks<=t;ks++)

#define sf          scanf

#define pf          printf

/*------------------------------Graph Moves----------------------------*/

const int fx[]= {+1,-1,+0,+0};

const int fy[]= {+0,+0,+1,-1};

//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move

//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move

//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move

//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move

/*---------------------------------------------------------------------*/

using namespace std;

//using namespace __gnu_pbds;

//

//template <typename T>  using orderedSet =

//    tree<T, null_type, less<T>,

//    rb_tree_tag, tree_order_statistics_node_update>;//find_by_order,order_of_key

//

int n;

int arr[100005];

void solve()

{

    cin>>n;

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

        cin>>arr[i];

    sort(arr,arr+n);

    int ans=0;

    for(int i=0;i<=arr[n-1] ;i++)

    {

        int x=upper_bound(arr,arr+n,i)-arr;

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

    }

    cout<<ans<<endl;

}



int main()

{

    solve();

}


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



using namespace std;



int main()

{

    int n;



    scanf("%d",&n);

    int a[n];

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

    {

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

    }





    sort(a,a+n);

    int start = a[n/2-1];

    int finish =a[(n/2)];

    int k;

    k=finish-start;

    printf("%d",k);



    return 0;

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

//#include <ext/pb_ds/assoc_container.hpp>

//#include <ext/pb_ds/tree_policy.hpp>

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

#define pb          push_back

#define inf         2e9+5

#define mp          make_pair

#define ll          long long

#define pii         pair<int,int >

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

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

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

#define PI          acos(-1.0)

#define ff          first

#define ss          second

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

#define Case(t)     for(int ks=1;ks<=t;ks++)

#define sf          scanf

#define pf          printf

/*------------------------------Graph Moves----------------------------*/

const int fx[]= {+1,-1,+0,+0};

const int fy[]= {+0,+0,+1,-1};

//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move

//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move

//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move

//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move

/*---------------------------------------------------------------------*/

using namespace std;

//using namespace __gnu_pbds;

//

//template <typename T>  using orderedSet =

//    tree<T, null_type, less<T>,

//    rb_tree_tag, tree_order_statistics_node_update>;//find_by_order,order_of_key

//

int n;

int arr[100005];

void solve()

{

    cin>>n;

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

        cin>>arr[i];

    sort(arr,arr+n);

    int ans=0;

    for(int i=0;i<=arr[n-1] ;i++)

    {

        int x=upper_bound(arr,arr+n,i)-arr;

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

    }

    cout<<ans<<endl;

}



int main()

{

    solve();

}


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

using namespace std;

 

int main() {

  int n, a[200001],mn;

  cin >> n;

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

  sort(a, a+n);

  if(a[n/2]==a[n/2-1]) cout << 0 << endl;

  else cout << (a[n/2]-a[n/2-1]) << endl;

  return 0; 

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

//#include <ext/pb_ds/assoc_container.hpp>

//#include <ext/pb_ds/tree_policy.hpp>

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

#define pb          push_back

#define inf         2e9+5

#define mp          make_pair

#define ll          long long

#define pii         pair<int,int >

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

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

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

#define PI          acos(-1.0)

#define ff          first

#define ss          second

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

#define Case(t)     for(int ks=1;ks<=t;ks++)

#define sf          scanf

#define pf          printf

/*------------------------------Graph Moves----------------------------*/

const int fx[]= {+1,-1,+0,+0};

const int fy[]= {+0,+0,+1,-1};

//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move

//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move

//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move

//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move

/*---------------------------------------------------------------------*/

using namespace std;

//using namespace __gnu_pbds;

//

//template <typename T>  using orderedSet =

//    tree<T, null_type, less<T>,

//    rb_tree_tag, tree_order_statistics_node_update>;//find_by_order,order_of_key

//

int n;

int arr[100005];

void solve()

{

    cin>>n;

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

        cin>>arr[i];

    sort(arr,arr+n);

    int ans=0;

    for(int i=0;i<=arr[n-1] ;i++)

    {

        int x=upper_bound(arr,arr+n,i)-arr;

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

    }

    cout<<ans<<endl;

}



int main()

{

    solve();

}


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

#include <algorithm>

using namespace std ;

int main()

{

    int n,d[100001],temp;

    cin>>n;

    int i;

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

    {

        cin>>d[i];

    }

    sort(d,d+n);

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

    cout<<temp;

    return 0;

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

//#include <ext/pb_ds/assoc_container.hpp>

//#include <ext/pb_ds/tree_policy.hpp>

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

#define pb          push_back

#define inf         2e9+5

#define mp          make_pair

#define ll          long long

#define pii         pair<int,int >

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

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

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

#define PI          acos(-1.0)

#define ff          first

#define ss          second

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

#define Case(t)     for(int ks=1;ks<=t;ks++)

#define sf          scanf

#define pf          printf

/*------------------------------Graph Moves----------------------------*/

const int fx[]= {+1,-1,+0,+0};

const int fy[]= {+0,+0,+1,-1};

//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move

//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move

//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move

//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move

/*---------------------------------------------------------------------*/

using namespace std;

//using namespace __gnu_pbds;

//

//template <typename T>  using orderedSet =

//    tree<T, null_type, less<T>,

//    rb_tree_tag, tree_order_statistics_node_update>;//find_by_order,order_of_key

//

int n;

int arr[100005];

void solve()

{

    cin>>n;

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

        cin>>arr[i];

    sort(arr,arr+n);

    int ans=0;

    for(int i=0;i<=arr[n-1] ;i++)

    {

        int x=upper_bound(arr,arr+n,i)-arr;

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

    }

    cout<<ans<<endl;

}



int main()

{

    solve();

}


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

using namespace std;



int main()

{

    int n,i,a,b,d;

    cin >> n;

    a = (n/2)-1;

    b = a+1;

    int N[n];

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

    {

        cin >> N[i];

    }

    sort(N,N+n);

    d = N[b]-N[a];

    cout << d << endl;

    return 0;

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

#include<iostream>

#include<fstream>

#define ll long long

using namespace std;



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 M = d[N-1];

    int ans = 0;

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

        int cnt = upper_bound(d.begin(), d.end(), i) - d.begin();

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

    }

    cout << ans << endl;

}


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

typedef long long ll;

typedef long double ld;

using namespace std;



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 m = d[N / 2 - 1], M = d[N / 2];

    cout << max(0, M - m) << endl;

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

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

#define ALL(v) (v).begin(),(v).end()

#define vi vector<int>

#define vvi vector<vi >

#define vvvi vector<vvi >

#define pii pair<int,int>

#define INF (int)1e9

#define MOD (int)1e9+7

typedef long long llong;

using namespace std;



int main(){

	int n;

	cin>>n;

	

	vi d(n);

	REP(i,n) cin>>d[i];

	

	sort(ALL(d));

	

	int ans=0;

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

		int num=lower_bound(ALL(d),i)-d.begin();

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

	}

	

	cout<<ans<<endl;

}


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

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

#define ALL(v) (v).begin(),(v).end()

#define vi vector<int>

using namespace std;



int main(){

	int n;

	cin>>n;

	

	vi d(n);

	REP(i,n) cin>>d[i];

	

	sort(ALL(d));

	

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

}//解答参考.
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int main() {

    ios::sync_with_stdio(false);

    cin.tie(0);



    int n;

    cin >> n;

    vector<int> as(n);

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

        cin >> as[i];

    }

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

    int ans = 0;

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

        if (lower_bound(as.begin(), as.end(), k) - as.begin() == n / 2) ans++;

    }

    cout << ans << endl;

}

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

using namespace std;



int main() {

    ios::sync_with_stdio(false);

    cin.tie(0);



    int n;

    cin >> n;

    vector<int> ds(n);

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

        cin >> ds[i];

    }

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

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

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

#include<string>

#include<vector>

#include<algorithm>

#include<bitset>

#include<set>

#include<map>

#include<stack>

#include<queue>

#include<iomanip>

using namespace std;



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

#define rep(i, n) repr(i, 0, n)

#define INF 2e9

#define MOD 1000000007

#define LINF (long long)4e18



using ll = long long;







int main(){

    int N; cin >> N;

    vector<int> d(N);

    rep(i,N) cin >> d[i];

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

    int ans = 0;

    rep(i,100010){

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

        int cnt1 = index;

        int cnt2 = N - index;

        if(cnt1 == cnt2) ans++;

    }

    cout << ans << endl;

    

}


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

#include<string>

#include<vector>

#include<algorithm>

#include<bitset>

#include<set>

#include<map>

#include<stack>

#include<queue>

#include<deque>

#include<list>

#include<iomanip>

#include<cmath>

#include<cstring>

#include<functional>

using namespace std;



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

#define rep(i, n) repr(i, 0, n)

#define INF 2e9

#define MOD 1000000007

//#define MOD 998244353

#define LINF (long long)4e18

#define jck 3.141592



using ll = long long;

using Pi = pair<int,int>;

using Pl = pair<ll,ll>;



int main(){

    int N; cin >> N;

    vector<int> d(N);

    rep(i,N) cin >> d[i];

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

    int ans = d[N/2]-d[N/2-1];

    cout << ans << endl;

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

#include <algorithm>

using namespace std;

int d[1000000];

int main(){

	int n;

	cin>>n;

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

		cin>>d[i];

	}

	sort(d,d+n);

	cout<<(d[n/2]-d[n/2-1]);

}

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

#include<cstring>

#include<algorithm>

using namespace std;

int num[1000000];

int main()

{

	int n;

	scanf("%d",&n);

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

	{

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

	}

	

	sort(num,num+n);

	//printf("%d %d",num[0],num[1]);

	int count=num[n/2]-num[n/2-1];

	printf("%d",count);

	

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

typedef long long ll;

#define vstroku() to_string()

#define vchislo() to_ulong()

#define gcd(x,y) __builtin_gcd(x,y)

#define numberof1(x) __builtin_popcount(x)

#define povsemelementam(i,mnozh) for(auto i: mnozh)

#define podotrezok(i,j) substr(i-1,j) // like prefix sum, (i,j)=s[j]-s[i-1]

#define pb push_back

#define pf push_front

#define popf pop_front

#define popb pop_back 

#define pii pair <int, int>

#define F first

#define S second

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





using namespace std;

const ll INFLL = 1e18;

const int MAXN = 3e5;

const ll INF = 1e9;

const ll kek=998244353;



int main() {

mipletsplay;

int n;

cin>>n;

vector <int> a(n);

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

cin>>a[i];

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

int f=n/2;

int cnt=0;



if (a[f]==a[f-1])

{

    cout<<0;

    return 0;

    

}

else

{

cnt=a[f]-a[f-1];

cout<<cnt;

}}


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

#include<cstring>

#include<algorithm>

using namespace std;

int num[1000000];

int main()

{

	int n;

	scanf("%d",&n);

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

	{

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

	}

	

	sort(num,num+n);

	//printf("%d %d",num[0],num[1]);

	int count=num[n/2]-num[n/2-1];

	printf("%d",count);

	

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

#include <vector>

#include <algorithm>





using namespace std;



int compare(const void * x1, const void * x2)   // функция сравнения элементов массива

{

	return (*(int*)x1 - *(int*)x2);              // если результат вычитания равен 0, то числа равны, < 0: x1 < x2; > 0: x1 > x2

}



int main() {

	int n;

	cin >> n;

	vector<int> D(n);

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

		cin >> D.at(i);

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

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

	return 0;

}

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

#include<cstring>

#include<algorithm>

using namespace std;

int num[1000000];

int main()

{

	int n;

	scanf("%d",&n);

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

	{

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

	}

	

	sort(num,num+n);

	//printf("%d %d",num[0],num[1]);

	int count=num[n/2]-num[n/2-1];

	printf("%d",count);

	

}
// Slower C++ solution:
/*

 Shahadat Hossain

 I.C.T Department

 Comilla University

 Session: 2013-2014

 */



#include<bits/stdc++.h>

using namespace std;



typedef long long ll;

typedef unsigned long long ull;



#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))

#define UNIQUE(x)       x.erase(unique(all(x)), x.end())



#define fs              first

#define sc              second

#define pb              push_back



#define sz(x)           (int)x.size()

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

#define D(x)            cerr << #x " = " << x << '\n'

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

#define valid(x,y,n, m)      x>=0 && y>=0 && x<n && y<m



#define input           freopen("/Users/shahadat/Desktop/input.txt", "r", stdin)

#define output          freopen("/Users/shahadat/Desktop/output.txt", "w", stdout)



#define endl            '\n'

#define eps             1e-5

#define yes             printf("Yes\n")

#define no              printf("No\n")



#define int             long long



inline void fast(){

    ios_base::sync_with_stdio(false);

    cin.tie(NULL); cout.tie(NULL);

}



//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

//uniform_int_distribution<int>(10, 20)(rng);



int gcd(int n,int m){return m==0?n:gcd(m,n%m);}

inline int Set(int n,int pos) { return n = n | (1LL << pos); }

inline int Reset(int n,int pos) { return n = n & ~(1LL << pos); }

inline bool Check(int n,int pos) { return (bool)(n & (1LL << pos)); }

inline int Count(ll n) { return __builtin_popcountll(n); }



typedef pair<int,int> pint;



//int const INF = 1e9 + 10;

//int const MOD = 1e9 + 7;



int const N = 1e6;

int ar[N];



int32_t main(){

    int n;

    cin >> n;

    

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

        cin >> ar[i];

    }

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

    

    int mid = n / 2;

    int res = ar[mid + 1] - ar[mid];

    cout << res << endl;

}








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

#include<cstring>

#include<algorithm>

using namespace std;

int num[1000000];

int main()

{

	int n;

	scanf("%d",&n);

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

	{

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

	}

	

	sort(num,num+n);

	//printf("%d %d",num[0],num[1]);

	int count=num[n/2]-num[n/2-1];

	printf("%d",count);

	

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

#include <algorithm>

using namespace std;

int d[1000000];

int main(){

	int n;

	cin>>n;

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

		cin>>d[i];

	}

	sort(d,d+n);

	cout<<(d[n/2]-d[n/2-1]);

}

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

#include<map>

#include<vector>

#include<map>

#include<algorithm>

using namespace std;

int p[200008];

int main(){

  int n;

  scanf("%d",&n);

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

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

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

  int x=n/2;

  x=p[x+1]-p[x];

 // x--;

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

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

typedef long long ll;

#define vstroku() to_string()

#define vchislo() to_ulong()

#define gcd(x,y) __builtin_gcd(x,y)

#define numberof1(x) __builtin_popcount(x)

#define povsemelementam(i,mnozh) for(auto i: mnozh)

#define podotrezok(i,j) substr(i-1,j) // like prefix sum, (i,j)=s[j]-s[i-1]

#define pb push_back

#define pf push_front

#define popf pop_front

#define popb pop_back 

#define pii pair <int, int>

#define F first

#define S second

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





using namespace std;

const ll INFLL = 1e18;

const int MAXN = 3e5;

const ll INF = 1e9;

const ll kek=998244353;



int main() {

mipletsplay;

int n;

cin>>n;

vector <int> a(n);

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

cin>>a[i];

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

int f=n/2;

int cnt=0;



if (a[f]==a[f-1])

{

    cout<<0;

    return 0;

    

}

else

{

cnt=a[f]-a[f-1];

cout<<cnt;

}}


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

#include<map>

#include<vector>

#include<map>

#include<algorithm>

using namespace std;

int p[200008];

int main(){

  int n;

  scanf("%d",&n);

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

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

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

  int x=n/2;

  x=p[x+1]-p[x];

 // x--;

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

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

#include <vector>

#include <algorithm>





using namespace std;



int compare(const void * x1, const void * x2)   // функция сравнения элементов массива

{

	return (*(int*)x1 - *(int*)x2);              // если результат вычитания равен 0, то числа равны, < 0: x1 < x2; > 0: x1 > x2

}



int main() {

	int n;

	cin >> n;

	vector<int> D(n);

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

		cin >> D.at(i);

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

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

	return 0;

}

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

#include<map>

#include<vector>

#include<map>

#include<algorithm>

using namespace std;

int p[200008];

int main(){

  int n;

  scanf("%d",&n);

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

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

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

  int x=n/2;

  x=p[x+1]-p[x];

 // x--;

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

}