// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



#define INDEXED_SET 0



#if INDEXED_SET

#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;

using indexed_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;

//find_by_order(i) - iterator to i-th element

//order_of_key(x) - x's index in the set

#endif



#define FAST_IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)

#define leading_0s(x) __builtin_clz(x)  //left 0s

#define trailing_0s(x) __builtin_ctz(x) //right 0s

#define count_1s(x) __builtin_popcount(x)

#define parity_1s(x) __builtin_parity(x) // 0 = even, 1 = odd

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

#define FORD(i,a,b) for (int i = int((a)); i >= int((b)); i--)

#define F first

#define S second

#define PB push_back

#define MP make_pair



#define endl '\n'

#define MAX 200005



using ll = long long;

using pi = pair<int,int>;

using pll = pair<long,long>;

using vi = vector<int>;

using vll = vector<ll>;

using vpi = vector<pi>;

using vpll = vector<pll>;



const int mod = 1e9 + 7;

const ll LLINF = 0x3f3f3f3f3f3f3f3f;





int main()

{

    FAST_IO;



    int n;

    cin >> n;

    vi v(n);

    for (auto &e:v)

        cin >> e;

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

    

    int ans = 0;

    int teto = 1e5;

    FORI(i,1,teto) {

        auto it = lower_bound(v.begin(), v.end(), i);

        if (int(v.size() / 2) == it - v.begin())

            ans++;

    }

    cout << ans << endl;

    return 0;

}

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

using namespace std;



///******************************** C o n t a i n e r ********************************///



typedef long long ll;

typedef unsigned long long ull;

typedef vector<int> vi;

typedef vector<ll> vl;

typedef pair<int,int> pii;

typedef pair<ll,ll> pll;

typedef vector<pii> vii;

typedef vector<pll> vll;



///*********************************** C o n s t ***********************************///



const int       N=1e6+123;

const double    PI = acos(-1);

const ll        MOD=1000000007;                 ///1e9+7

ll dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};       ///first 4 for adjacent

ll dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

ll dx8[]= {+1, +1, -1, -1, +2, +2, -2, -2};    ///knights move

ll dy8[]= {+2, -2, +2, -2, +1, -1, +1, -1};



///********************************** M a r c o ***********************************///



#define pb push_back

#define F first

#define S second

#define test int tc; cin>>tc; while(tc--)

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

#define rforn(i,n) for(i=n-1;i>=0;i--)

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

#define rall(a) a.rbegin(),a.rend()

#define sz(x) x.size()

#define el <<'\n'

#define sp <<' '

#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}

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

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

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

#define sqr(a) (a)*(a)



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

#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);



///*********************************** F u n c t i o n ***********************************///



ll powmod(ll a,ll b){ a%=MOD;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=MOD;--b;}a*=a;a%=MOD;b/=2;}return pr;}

ll modinverse(ll a){return powmod(a,MOD-2);}

bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}

void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=3;ii<=mx;ii+=2)if(!a[ii])for(jj=ii*ii;jj<N;jj+=2*ii)a[jj]=true;}

void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}

void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}



///**************************************************** C o d e ****************************************************///

///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///







void _case()

{

    ll n,i,ans=0;

    cin>>n;

    ll a[n];

    forn(i,n) cin>>a[i];

    sort(a,a+n);

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

    else{

        ll x=a[n/2];

        while(x!=a[n/2-1]) x--,ans++;

        cout<<ans el;

    }

}



main()

{

    fastio();

    _case();



}





///Thank you.





///Brainless_Loco Terminates Here!


// Fastest known solution for this problem: