stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll MAXN=1e5+5;

const ll MOD=998244353;

const ll INF=1e18;

ll n,a[MAXN];



void solve()

{

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

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

}

int main()

{

//    freopen("c://duipai//data.txt","r",stdin);

//    freopen("c://duipai//wa.txt","w",stdout);

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

    {

//        string ss;

//        cin>>ss;

//        cout<<ss<<endl;

       // solve();

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

        {

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

        }

        solve();

    }

}

/*

5

76578820211343624  293297008968192 189152283861189120 324294649604739072 20266198324215808

*/


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<algorithm>

using namespace std;

int main()

{

	int n,i,b,a[100005];

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

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

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

	 sort(a,a+n);

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

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



#pragma comment(linker, "/stack:200000000")

#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")



typedef long long ll;

typedef unsigned long long ull;

// typedef __int128_t lll;

#define fatnet ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);



using namespace std;



const ll MOD1 = 1e9 + 7;

const ll MOD2 = 2000003983; // 3571 1e9 + 97

const ll MOD3 = 1e9 + 9;

const ll p1 = 1e6 + 3;

const ll p2 = 2017; // 131 37

const ll p3 = 37;

const ll INF = 5e18;



int main() {

    fatnet;



    ll n;

    cin >> n;

    vector < ll > a(n);

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

        cin >> a[i];

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

    cout << a[n / 2] - a[n / 2 - 1] << "\n";



    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<algorithm>

using namespace std;

int main()

{

	int n,i,b,a[100005];

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

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

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

	 sort(a,a+n);

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

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream> 

#include <algorithm>

using namespace std;



int n,arr[100000];

int main(){

	cin>>n;

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

		cin>>arr[i]; 

	} 

	sort(arr,arr+n); 

	int sum=arr[n/2]-arr[n/2-1];

	cout<<sum;

	return 0; 

} 

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<algorithm>

using namespace std;

int main()

{

	int n,i,b,a[100005];

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

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

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

	 sort(a,a+n);

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

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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();

}


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}//解答参考.

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

    

}


// Optimized solution to the same problem (faster):
#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;

}

    




// Fastest known solution for this problem:
// Original C++ solution (slower):
#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]);

}

// Optimized solution to the same problem (faster):
#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);

	

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}}


// Optimized solution to the same problem (faster):
#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);

	

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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);

	

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
/*

 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;

}








// Optimized solution to the same problem (faster):
#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);

	

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <vector>

#include <algorithm>

using namespace std;



int main() {

	int N,count=0;

	cin >> N;

	vector<int> v(N);

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

		cin >> v[i];

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

	for (int i = v[(v.size() / 2) - 1]; i < v[(v.size() / 2)]; i++)

	{

		count++;

	}

	cout << count;

	system("pause");

	return 0;

}

// Optimized solution to the same problem (faster):
#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);

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main(){

    int n;

    cin >> n;

    vector<int>v(n);

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

        cin >> v[i];

    }

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

    int r = v[n-1];

    int cnt=0;

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

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

     int rs = n-x;

     int ls = n-rs;

     if(rs == ls){

         cnt++;

     }

    }

     cout << cnt << '\n';

    

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

int main(){

    int n;

    cin >> n;

    vector<int>v(n);

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

        cin >> v[i];

    }

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

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

    

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<string>

#include<map>

#include<vector>

#include<algorithm>

using namespace std;



int main(){

  int N, K = 0; cin >>N;

  vector<int> ds(N);

  for(int& d : ds){ cin >>d; }

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

  for(int k = ds[0]; k <= ds[N - 1]; k++){

    int i = lower_bound(ds.begin(), ds.end(), k) - ds.begin();

    if(N / 2 == i) K++;

  }

  cout <<K <<endl;

  return 0;

}


// Optimized solution to the same problem (faster):
#include<iostream>

#include<string>

#include<map>

#include<vector>

#include<algorithm>

using namespace std;



int main(){

  int N; cin >>N;

  vector<int> ds(N);

  for(int& d : ds) cin >>d;

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

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

  return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}




// Optimized solution to the same problem (faster):
#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;

}




// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


















// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem: