Problem:
 Score : 300 points    Problem Statement Takahashi made N problems for competitive programming.
The problems are numbered 1 to N , and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K , as follows:   A problem with difficulty K or higher will be for ARCs .  A problem with difficulty lower than K will be for ABCs .   How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?      Problem Statement  2 \leq N \leq 10^5  N is an even number.  1 \leq d_i \leq 10^5  All values in input are integers.         Input Input is given from Standard Input in the following format:  N  d_1  d_2  ...  d_N       Output Print the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.        Sample Input 1 6
9 1 4 4 6 7      Sample Output 1 2  If we choose K=5 or 6 , Problem 1 , 5 , and 6 will be for ARCs, Problem 2 , 3 , and 4 will be for ABCs, and the objective is achieved.
Thus, the answer is 2 .       Sample Input 2 8
9 1 14 5 5 4 4 14      Sample Output 2 0  There may be no choice of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.       Sample Input 3 14
99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1      Sample Output 3 42685

Solution (Python):
N = int(input())
d = sorted([int(i) for i in input().split()])

print(d[N // 2] - d[N // 2 - 1])

Solution (Python):
n = int(input())
li = list(map(int,input().split()))
li.sort()
ha = int(len(li)/2)
if li[ha] == li[ha-1]:
    ans = 0
else:
    ans = li[ha] - li[ha-1]
print(ans)

Solution (Python):
N = int(input())
D = list(map(int, input().split()))

D.sort()
if D[int(N/2)] == D[int(N/2-1)]:
    ans = 0
else:
    ans = D[int(N/2)] - D[int(N/2-1)]

print(ans)

Solution (Python):
"""


 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())


 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  


a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654


char_list = list("abcd") 
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    N = int(sys.stdin.readline())
    l = list(map(int, sys.stdin.readline().split()))

    l.sort()

    length = len(l)
    if (length % 2 == 1):
        print(0)
        exit()

    pre = int(length / 2 - 1)
    post = int(length / 2)

    print(l[post] -l[pre])

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
num = 0
d.sort()
num = d[n//2]-d[n//2-1]
print(num)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))

d_sorted = sorted(d)

start = d_sorted[int(N/2)-1]
end   = d_sorted[int(N/2)]

res = end - start

print(res)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
d.sort()
print(d[n//2]-d[n//2-1])

Solution (Python):
N = int(input())
d = list(sorted(map(int, input().split())))

a = d[N//2 - 1]
b = d[N//2]
print(b-a)

Solution (Python):

import sys
from collections.abc import Iterable
from math import *
from itertools import *
from collections import *
from functools import *
from operator import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(N: int, d: "List[int]"):
    d = sorted(d)
    hi = N // 2
    return d[hi] - d[hi - 1]


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    d = [ int(next(tokens)) for _ in range(N) ]  
    result = solve(N, d)
    if isinstance(result, Iterable) and not isinstance(result, str):
        result = '\n'.join([str(v) for v in result])
    print(result)

if __name__ == '__main__':
    main()

Solution (Python):



n = int(input())
li = list(map(int,input().split()))
li_srtd = sorted(li)

if li_srtd[n // 2] == li_srtd[n // 2 - 1]:
    print(0)
else:
    print(li_srtd[n // 2] - li_srtd[n // 2 - 1])

Solution (Python):

N = int(input())
di = list(map(int, input().split()))


ans=0
sumd=len(di)
dis=sorted(di)



print(dis[int(N/2+1-1)]-dis[int(N/2-1)])

Solution (Python):
n1 = int(input())

n2 = [int(i) for i in input().split()]

n2.sort()

n3 = n2[(n1 // 2)] - n2[(n1 // 2) - 1]

print(n3)

Solution (Python):
N=int(input())
D=list(map(int,input().split()))
D.sort()
print(D[int(N/2)]-D[int(N/2)-1])

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
d.sort()
h=n//2
print(d[-h]-d[h-1])

Solution (Python):
n, a = input(), sorted(map(int, raw_input().split()))

print a[n / 2] - a[n / 2 - 1]

Solution (Python):
N = int(input())
d = sorted([int(c) for c in input().split()])
print(d[N//2]-d[N//2-1])

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
d.sort()
half = n // 2
abc = d[half - 1]
arc = d[half]
if abc == arc:
    print(0)
else:
    print(arc-abc)

Solution (Python):
num = int(input())
in_list = list(map(int, input().split()))

sorted_list = sorted(in_list)

print(sorted_list[int(num / 2)] - sorted_list[int(num / 2) - 1])

Solution (Python):
n = int(input())
d = list(map(int,input().split()))

d.sort()

a = (int)((n/2) - 1)
b = (int)(n/2)

ans = d[b] - d[a]
print(ans)

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
d.sort()
print(d[int(n/2)]-d[int(n/2-1)])

Solution (Python):
from sys import stdin

n = int(stdin.readline().rstrip())
an = list(map(int, input().split()))

an.sort()

l = len(an)
h = l//2



ans = an[h] - an[h-1]

print(ans)

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
d.sort()
a = len(d) // 2
b = (d[a]+1) - (d[a-1]+1)
print(b)

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
l.sort()


x = 0
y = 0
if n%2 == 0:
  x = n//2 - 1
else:
  y = 1


ans = 0
if y == 0:
  ans = l[x+1] - l[x]
print(ans)

Solution (Python):
N = int(input())
D = list(map(int, input().split()))

D.sort()

mid = int(N/2)
if D[mid - 1] == D[mid]:
    print(0)
else:
    print(D[mid] - D[mid-1])

Solution (Python):
n=int(input())
K=[int(i) for i in input().split()]

K.sort()
if K[n//2]==K[n//2-1]:
    print(0)
else:
    print(K[n//2]-K[n//2-1])

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
d.sort()

min = d[n//2-1]
max = d[n//2]

print((max-(min+1))+1)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
e = sorted(d)
a = n//2
b = -1
if e[a]-e[a-1]==0:
    b = 0
else:
    b = e[a]-e[a-1]
print(b)

Solution (Python):
N = int(input())
D = list(map(int, input().split()))

Dsorted = sorted(D)

l = Dsorted[N//2-1]
r = Dsorted[N//2]

print(r-l)

Solution (Python):
n=int(input())
l=sorted(list(map(int,input().split())))
ans=l[int(n/2)]-l[int(n/2)-1]
print(ans)

Solution (Python):
N=int(input())
d=list(map(int,input().split()))
D=sorted(d)
half=N//2
print(D[half]-D[half-1])

Solution (Python):
N = int(input())
huga = input().split()
d = []
for i in range(N):
  d.append(int(huga[i]))
  
hage = sorted(d)
print(abs(hage[int(N/2)] - hage[int(N/2) - 1]))

Solution (Python):
N = int(input())

inp = list(map(int, input().split()))

inp.sort()

d = int(N / 2)

ans = inp[d] - inp[d - 1]

print(ans)

Solution (Python):
N = int(input())
d = [int(c) for c in input().split(' ')]
d.sort()
print(d[N // 2] - d[N // 2 - 1])

Solution (Python):

import sys

n = int(input())
s = [int(c) for c in input().split(' ')]

if len(s) % 2 == 1:
    print(0)
    exit()

s_sorted = sorted(s)



print(s_sorted[n//2] - s_sorted[n//2-1])

Solution (Python):
N = int(input())

d = list(map(int,input().split()))

d_sort = sorted(d)

print(d_sort[N//2] - d_sort[N//2-1])

Solution (Python):
n = int(input())
*d, = map(int, input().split())

d.sort()

print(d[n//2] - d[n//2-1])

Solution (Python):
N = int(input())
D = [int(x) for x in input().split(' ')]

D.sort()
d1 = D[N//2 - 1]
d2 = D[N//2]
print(d2 - d1)

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
d.sort()
print(d[n//2]-d[n//2-1])

Solution (Python):


n = int(input())
d = sorted(list(map(int, input().split())))

h1 = int(n/2-1)
h2 = int(n/2)
if d[h1] == d[h2]:
    print(0)
else:
    print(d[h2]-d[h1])

Solution (Python):
N = int(input())
dlist = list(map(int, input().split()))

dlist.sort()
N = int(N/2)
print(dlist[N]-dlist[N-1])

Solution (Python):


n = int(input())
d = list(map(int, input().split()))


d.sort()
print(d[int(n/2)] - d[int(n/2)-1])

Solution (Python):
import bisect

N = int(input())
dlist = list(map(int, input().split()))

dlist.sort()

inta = dlist[(N // 2) - 1]
intb = dlist[(N // 2)]

ans = intb - inta
print(ans)

Solution (Python):
n=int(input())>>1
d=list(map(int,input().split()))
d.sort()
print(d[n]-d[n-1])

Solution (Python):
N = int(input())
d = list(map(int, input().split()))[:N]


sd = sorted(d)


mid = int(len(sd)/2)


l_max = sd[mid-1]
r_min = sd[mid]

print(r_min - l_max)

Solution (Python):
N = int(input())
D = list(map(int, input().split()))

D.sort()

end = N // 2
start = (N // 2) - 1

print(len(range(D[start]+1, D[end]+1)))

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
d.sort()

a = d[N//2]
b = d[(N//2) - 1]
print(a - b)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))

d.sort()

a = n // 2
b = a - 1

print(d[a] - d[b])

Solution (Python):
n = int(input()) 
d = sorted(list(map(int, input().split())))
x = n // 2
print(abs(d[x] - d[x - 1]))

Solution (Python):


N = int(input())
d = [int(e) for e in input().split()]

sorted_d = sorted(d)

ans = sorted_d[N//2] - sorted_d[N//2-1]

print(ans)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
d.sort()

ans = 0
med = int(len(d) / 2)
if d[med - 1] != d[med]:
    ans += d[med] - d[med - 1]
print(ans)

Solution (Python):
n=int(input())
d=sorted(map(int, input().split()))
print(d[int(n/2)]-d[int(n/2)-1])

Solution (Python):
n = int(input())
d = list(map(int, input().split(' ')))

d.sort()
print(d[n // 2] - d[n//2 - 1])

Solution (Python):
n = int(input())
li = list(map(int,input().split()))
cnt = 0
li.sort()
if len(set(li)) == 1:
        cnt = 0
elif li[int(n/2 - 1)] == li[int(n/2)]:
        cnt = 0
else:
        cnt = li[int(n/2)] - li[int(n/2 -1)]
print(cnt)

Solution (Python):
n = int(input())
if n % 2 != 0:
    print(0)

l = list(map(int, input().split()))
l.sort()
print(l[n // 2] - l[n // 2 - 1])

Solution (Python):
n = int(input())
d = list(map(int,input().split()))

d.sort()
print(d[n // 2] - d[n // 2 - 1])

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
d.sort()
print(d[n//2]-d[n//2-1])

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd


def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    n=INT()
    d=LIST()
    d.sort()

    print(max(0,d[int(n/2)]-d[int(n/2-1)]))

if  __name__=='__main__':
    main()

Solution (Python):
N = int(input())
d = list(map(int, input().split(' ')))



d.sort()


mid = N // 2

if(d[mid - 1] == d[mid]):
    count = 0
else:
    count = d[mid] - d[mid - 1]

print(count)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
d.sort()
n = int(N/2)

if d[n-1] - d[n] == 0:
    print(0)
else:
    print(abs(d[n-1] - d[n]))

Solution (Python):
n = int(input())
a = int(n/2)
l = [int(i) for i in input().split()]
l.sort()
print(l[a]-l[a-1])

Solution (Python):
n = int(input())
d = list(map(int, input().split()))

d.sort()
print(d[n // 2] - d[n // 2 - 1])

Solution (Python):
n = int(input())
d = list(map(int, input().split()))

d.sort()

this = 0

if n % 2 == 1:
    this = n % 2 + 1
    answer=d[this+1]-d[this]

else:
    this=n//2
    answer=d[this]-d[this-1]

print(answer)

Solution (Python):
N = int(input())
L = input().split()
L = [int(x) for x in L]

L=sorted(L)

if(N%2==0):
	low_K = N//2-1
	if(L[low_K]!=L[low_K+1]):
		print(L[low_K+1]-L[low_K])
	else:
		print(0)
else:
	print(0)

Solution (Python):

def input_from_console():
    n = int(input().strip())
    d_list = list(map(int, input().strip().split()))
    return n, d_list


def solve(n, d_list):
    result = 0
    divider = n //2
    d_list.sort()
    pre = d_list[:divider]
    lower = max(pre) + 1
    post = d_list[divider:]
    upper = min(post)
    if lower <= upper:
        result = upper - lower + 1
    return result


def main():
    n, d_list = input_from_console()
    print(solve(n, d_list))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  
        check_cases()
    else:
        main()

Solution (Python):
N = int(input())
d = list(map(int,input().split()))


d.sort()
m = d[N//2-1]
M = d[N//2]
ans = 0
if m == M:
    ans = 0
else:
    ans = M - m
print(ans)

Solution (Python):

N = int(input())
nums = list(map(int, input().split()))


sorted_nums = sorted(nums)


Q = int(N / 2)
P = Q - 1

print(sorted_nums[Q] - sorted_nums[P])

Solution (Python):
N=int(input())
d=input().split()
for i in range(N):
    d[i]=int(d[i])
d.sort()
a=d[(N//2)]-d[N//2-1]
print(a)

Solution (Python):
from sys import stdin

def main():
    N = int(input())
    D = list(map(int, input().split()))

    D.sort()
    m = N // 2
    print(D[m] - D[m-1])

input = lambda: stdin.readline()
main()

Solution (Python):
n=int(input())
d=list(map(int, input().split())) 

x=sorted(d)
v=x[n//2]-x[n//2-1]
print(v)

Solution (Python):
n = int(input())
dn = [int(i) for i in input().split()]

ha = n//2 - 1
dn.sort()
if dn[ha] == dn[ha+1]:
  print(0)
else:
  print(dn[ha+1]-dn[ha])

Solution (Python):
N = int(input())
S = list(map(int,input().split()))
S.sort()
print(S[N//2]-S[N//2-1])

Solution (Python):
n = int(input())
li = list(map(int,input().split()))
cnt = 0
li.sort()
if len(set(li)) == 1:
        cnt = 0
elif li[int(n/2 - 1)] == li[int(n/2)]:
        cnt = 0
else:
        cnt = li[int(n/2)] - li[int(n/2 -1)]
print(cnt)

Solution (Python):
N=int(input())
A=list(map(int,input().split()))

A.sort()
s=0

print(A[N//2]-A[N//2-1])

Solution (Python):
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    n = int(input())
    dl = list(map(int, input().split()))

    dl.sort()
    midindex = n // 2

    print(dl[midindex] - dl[midindex-1])

Solution (Python):
n = int(input())
d = [int(i) for i in input().split()]

sorted_d = sorted(d)

a = sorted_d[int(n/2)]
b = sorted_d[int(n/2) - 1]

print(a-b)

Solution (Python):
import sys

n = int(input())
p = list(map(int, input().split()))
p = sorted(p)
cen = int(n/2)
print(p[cen] - p[cen-1])

Solution (Python):
N = int(input())
D = list(map(int, input().split()))

D.sort()
if D[N//2-1]==D[N//2]:
    print(0)
else:
    print(D[N//2]-D[N//2-1])

Solution (Python):
import sys
import numpy as np
sys.setrecursionlimit(1000000)
 
n = int(input())
d = list(map(int,input().split()))

d.sort()

if d[int(len(d)/2)] == d[int(len(d)/2 - 1)]:
    print(0)
    exit()
    
print(d[int(len(d)/2)] - d[int(len(d)/2 - 1)])

Solution (Python):
from sys import stdin

N=int(stdin.readline().rstrip())
if N % 2 == 1:
    output=0
else:
    num_list=[int(x) for x in stdin.readline().rstrip().split()]
    num_list.sort()
    output=0
    half=int(N/2)
    output=num_list[half]-num_list[half-1]

print(output)

Solution (Python):
N = int(input())
M = int(N / 2)
d = sorted(list(map(int, input().split())))
if d[M - 1] == d[M]:
    print(0)
else:
    print(d[M] - d[M - 1])

Solution (Python):

import sys

def delete(larger, move):
    for i in move:
        larger.remove(i)
    return larger

def solve(N: int, d: "List[int]"):
    ABC = []
    ARC = sorted(d)

    count = 0

    for K in range(10**6):
        move = []
        for i in ARC:
            if i < K:
                move.append(i)
            else:
                break
        ABC += move
        delete(ARC, move)

        if len(ABC) == len(ARC):
            count += 1
        elif len(ABC) > len(ARC):
            break
        
    print(count)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    d = [ int(next(tokens)) for _ in range(N) ]  
    solve(N, d)

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
d = sorted(list(map(int, input().split())))

if d[n//2-1] == d[n//2]:
    print(0)
else:
    print(d[n//2] - d[n//2-1])

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
d.sort()
print(d[n // 2] - d[n // 2 - 1])

Solution (Python):

n = int(input())
d = list(map(int,input().split()))
d.sort()
sub = d[n//2] - d[n//2 - 1]
print(sub)

Solution (Python):
from sys import stdin
N = int(stdin.readline().rstrip())
input = stdin.readline().split()
d = [int(input[i]) for i in range(N)]
d_sorted = sorted(d)




print(d_sorted[int(N/2)] - d_sorted[int(N/2)-1])

Solution (Python):
n=int(input())
d=sorted(list(map(int,input().split())))
print(d[n//2]-d[n//2-1])

Solution (Python):
n=int(input())
x=list(map(int,input().split()))
x.sort()
print(x[n//2]-x[n//2-1])

Solution (Python):
import sys

def solve(n, d):
    d = sorted(d)
    return d[n/2] - d[n/2 - 1]


if __name__ == '__main__':

    n = sys.stdin.readline().strip()
    d = map(int, sys.stdin.readline().strip().split(" "))
    print solve(int(n), d)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))

d = sorted(d)

print(d[int(N/2)] - d[int(N/2)-1])

Solution (Python):
n = int(input())
D = sorted(list(map(int, input().split())))

half = int(n/2)

print(D[half] - D[half-1])

Solution (Python):

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  l=LI()

  l.sort()

  a=l[n//2-1]
  b=l[n//2]

  return b-a

print(main())

Solution (Python):
su=int(input())
num=list(map(int,input().split()))
ar=num.sort()
half=int(su/2)
print(num[half]-num[half-1])

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
d.sort()

abc = 0
arc = N

ans = 0
for k in range(1, 10 ** 5 + 1):
    while True:
        if abc >= N:
            break
        elif d[abc] < k:
            abc += 1
            arc -= 1
        else:
            break
    if abc == arc:
        ans += 1
    elif abc > arc:
        break

print(ans)

Solution (Python):
N = int(input())
ds = [int(p) for p in input().split(" ")]
k = 0
ds.sort()
ma = ds[N//2-1]
mi = ds[N//2]
print(mi - ma)

Solution (Python):
n = int(input())
lst = [int(i) for i in input().split()]
lst = sorted(lst)
cnt = 0
d = int(n/2-1)
l = lst[d]
u = lst[d+1]
   
if l==u:
    cnt = 0
else:
    cnt = u-l
print(cnt)

Solution (Python):
N = int(input())
d = [int(x) for x in input().split()]

sorted = sorted(d)

result = sorted[N//2] - sorted[N//2-1]
print(result)

Solution (Python):
N=int(input())
d=list(map(int, input().split()))
count=0

d.sort()

small=d[(N//2)-1]
large=d[N//2]

ans=large-small

print(ans)

Solution (Python):
n = int(input())
p = list(map(int, input().split()))

p.sort()

ans = p[int(n/2)] - p[int(n/2) - 1]
print(ans)

Solution (Python):
N = int(input())
d = sorted(map(int, input().split()))
print(d[N//2]-d[N//2-1])

Solution (Python):
n = int(input())
d = []
for i in input().split() :
	d.append(int(i))

def ans() :
	l = len(d)
	if l % 2 == 1 : return 0
	d.sort()
	l = int(l/2)
	if d[l-1] == d[l] : return 0
	return d[l] - d[l-1]

print(ans())

Solution (Python):
n = int(input())
d = list(map(int, input().split())) 

if int(n % 2) == 0:
	d.sort()
	print(d[int(n/2)] - d[int(n/2) - 1])
else:
	print(0)

Solution (Python):
N=int(input())
D=list(map(int,input().split()))
D=sorted(D)
nd=int(N/2)
nk=D[nd]-D[nd-1]

print(nk)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))

D = sorted(d)
x = int(N/2)


A = D[x-1]
B = D[x]

print(B-A)

Solution (Python):
N=int(input())
d=list(map(int,input().split()))

d.sort()

c=0

if d[N//2-1]!=d[N//2]:
    c=d[N//2]-d[N//2-1]

print(c)

Solution (Python):
N = int(input())
d = list(map(int,input().split()))
e = sorted(d)
l = e[N//2-1]
r = e[N//2]
print(r-l)

Solution (Python):
n = int(input())

lst = list(map(int, input().split()))
s_lst = sorted(lst)

f = n//2 
b = n//2 - 1
print(s_lst[f] - s_lst[b])

Solution (Python):
n = int(input())
d = list(map(int, input().split()))

dd = sorted(d)
ans = 0

if dd[int(n/2)] != dd[int(n/2)-1]:
    ans += dd[int(n/2)]-dd[int(n/2)-1]

print(ans)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
d.sort()

ans = d[N//2] - d[N//2 - 1]
print(ans)

Solution (Python):
n = int(input())
d = [int(x) for x in input().split()]

d.sort()
print(d[int(n / 2)] - d[int(n / 2) - 1])

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
d.sort()
print(max(0, d[N//2]-d[N//2 - 1]))

Solution (Python):

import bisect
n = int(input())
d = sorted(map(int, input().split()))
m1 = d[n // 2 - 1]
m2 = d[n // 2]
r = d[bisect.bisect_left(d, m2)]
l = d[bisect.bisect_left(d, m1)]
print(r - l)

Solution (Python):
N = int(input())
D = sorted([int(x) for x in input().split()])

center = N // 2

print(D[center] - D[center-1])

Solution (Python):
n = int(input()) // 2
d = sorted(list(map(int, input().split(' '))))
print(d[n] - d[n - 1])

Solution (Python):

import sys

def delete(larger, move):
    for i in move:
        larger.remove(i)
    return larger

def solve(N: int, d: "List[int]"):
    ABC = []
    ARC = sorted(d)

    count = 0

    for K in range(10**6):
        move = []
        for i in ARC:
            if i < K:
                move.append(i)
            else:
                break
        ABC += move
        delete(ARC, move)

        if len(ABC) == len(ARC):
            count += 1
        elif len(ABC) > len(ARC):
            break
        
    print(count)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    d = [ int(next(tokens)) for _ in range(N) ]  
    solve(N, d)

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
d = list(map(int,input().split(" ")))
a = 0
s_d = sorted(d)
easy_last = s_d[int(n/2)-1]
dif_start = s_d[int(n/2)]
a = dif_start-easy_last
print(a)

Solution (Python):
n = int(input())
d = list(map(int, input().split(' ')))
d = sorted(d)
mid = n//2-1
if d[mid] == d[mid+1]:
  ans = 0
else:
  start = d[mid] +1
  end = d[mid+1] 
  ans = end - start + 1
print(ans)

Solution (Python):
N = int(input())
arr = list(map(int, input().split()))

arr.sort()
print(arr[N//2]-arr[(N//2)-1])

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

a.sort()
print(a[len(a)//2] - a[len(a)//2-1])

Solution (Python):
n = int(input())
d = list(map(int, input().split()))

d = sorted(d)

print(d[int(n / 2)] - d[int((n / 2) - 1)])

Solution (Python):
import sys
N = int(input())
D = list(map(int, input().split()))
D.sort()

k = int(len(D) / 2)

print(D[k] - D[k-1])

Solution (Python):
n = int(input())
d = [int(v) for v in input().split()]

d.sort()
cnt = 0
if d[n//2] - d[n//2-1] > 1:
    cnt += d[n//2] - d[n//2-1] - 1
if d[n//2] > d[n//2-1]:
    cnt += 1
print(cnt)

Solution (Python):
N = int(input())

d = list(map(int, input().split()))

d.sort()

d_ma = d[(N//2)]
d_mi = d[(N//2)-1]

cnt = 0
for i in range(d_mi,d_ma):
    cnt += 1

print( cnt )

Solution (Python):

n = int(input())
lis = list(map(int,input().split()))
lis.sort()
if lis[n//2] == lis[n//2-1]:
    print(0)
else:
    print(lis[n//2] - lis[n//2-1])

Solution (Python):
N = int(input())
dList = list(map(int,input().split()))
dList.sort()
mid = (N-1)//2
isEven = N%2 ==0
sa = dList[mid+1] - dList[mid]

print(sa)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))

d.sort()

len_d = len(d)
print( d[int(len_d/2)] - d[int(len_d/2)-1] )

Solution (Python):
N = int(input())
d = input().split()
d = [int(i) for i in d]
d.sort()
if d[int(N/2)-1] == d[int(N/2)]:
    print(0)
else:
    print(d[int(N/2)] - d[int(N/2)-1])

Solution (Python):

n = int(input())
d_list = list(map(int, input().split()))

d_list.sort()

sep_l = d_list[(n//2) - 1]
sep_u = d_list[(n//2)]

ans = sep_u - sep_l

print(ans)

Solution (Python):
n = int(input())
dli = list(map(int,input().split()))
dli.sort()
print(dli[n//2]-dli[(n-1)//2])

Solution (Python):

N = int(input())
D = list(map(int, input().split(" ")))

D.sort()

k_1 = D[N//2 - 1]
k_2 = D[N//2]

ans = k_2 - k_1

print(ans)

Solution (Python):
import statistics
n= int(input())
d=list(map(int,input().split()))
d.sort()

k=int(d[int(n/2)]-d[int(n/2-1)])

print(k)

Solution (Python):
N = int(input())
lst = list(map(int, input().split()))
sorlist = sorted(lst)
A = N//2 - 1
B = N//2
if sorlist[A]!=sorlist[B]:
	ans = sorlist[B]-sorlist[A]
	print(ans)
else:
	print(0)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
d.sort()
h = n // 2
if d[h-1] == d[h]:
  print(0)
else:
  print(d[h]-d[h-1])

Solution (Python):
n = int(input())
number = list(map(int,input().split()))
number.sort()
q = number[n//2] -number[n//2-1]
if q == 0:
    print(0)
else:
    print(q)

Solution (Python):



def main():
    N = int(input())
    
    D = list(map(int, input().split()))
    ans = 0

    if N % 2 == 1:
        print(0)
        return
    D.sort()
    if D[N//2] == D[N//2 - 1]:
        print(0)
        return

    
    ans = len(range(D[N//2 - 1] + 1, D[N//2]+1))
    print(ans)
    return


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
dlist = sorted(list(map(int, input().split())))

st = dlist[N//2 -1]
ed = dlist[N//2]
if st == ed:
    print(0)
    exit()
cnt = 0
for i in range(st+1, ed+1):
    cnt = cnt + 1

print(cnt)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
d.sort()
print(d[int(n/2)]-d[int(n/2)-1])

Solution (Python):
N = int(input())
d =  [int(i) for i in input().split(" ")]

d = sorted(d)
print(d[int(N/2)] - d[int(N/2)-1])

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
d.sort()
print(d[n//2]-d[n//2-1])

Solution (Python):
N = int(input())
P = list(map(int, input().split()))
P = list(sorted(P))

if N % 2 == 1:
  print(0)
else:
  print(P[N//2]-P[N//2-1])

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
d.sort()
print(d[int(n/2)] - d[int(n/2)-1])

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
e = sorted(d)
print(e[int(n/2)] - e[int(n/2)-1])

Solution (Python):
N = int(input())
d = list(map(int, input().split()))

d.sort()

print(d[N // 2] - d[N // 2 - 1])

Solution (Python):
def read():
    n = int(input().strip())
    d = list(map(int, input().strip().split()))
    return n, d


def solve(n, d):
    d = sorted(d)
    median = n//2
    return d[median] - d[median-1]


if __name__ == '__main__':
    inputs = read()
    print('%d' % solve(*inputs))

Solution (Python):
n = int(input())
d = list(map(int, input().split()))

d.sort()
c = int(n/2)
ans = d[c] - d[c-1]
print(ans)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
d.sort()
print(d[N//2]-d[N//2 -1])

Solution (Python):
n = int(input())
d_s = [int(v) for v in input().split()]

d_s.sort()
mid = len(d_s) // 2
print(d_s[mid] - d_s[mid - 1])

Solution (Python):
N = int(input())
d = list(map(int,input().split()))
d.sort()
print(d[N//2]-d[N//2-1])

Solution (Python):

import time
import re
import math
import fractions

def main():
    global N,A,B,C,D,memo,mx,mn,temp
    N=int(input())
    D=list(map(int,input().split()))
    D.sort()
    print(D[N//2]-D[N//2-1])

start=time.time()
main()

Solution (Python):
N = int(input())
s = input().split()
d = []
for i in range(N):
    d.append(int(s[i]))
d.sort()
devide = len(d)//2
num =  d[devide]-d[devide-1]
print(num)

Solution (Python):
N = int(input())
p = list(map(int, input().split()))

p.sort()
print(p[int(N/2)] - p[int(N/2-1)])

Solution (Python):
n = int(input())
d = list(map(int,input().split()))

d.sort()

print(d[n//2] - d[n//2-1])

Solution (Python):
N = int(input())
d = list(map(int,input().split()))

sorted_d = sorted(d)


under_limit = sorted_d[int(N/2)-1]
upper_limit = sorted_d[int(N/2)]


ans = upper_limit - under_limit
print(ans)

Solution (Python):
N = int(input()) 
List = list(map(int,input().split())) 

List.sort()

n = int(N / 2)

if List[n-1] == List[n]:
    print(0)
else:
    print(List[n] - List[n-1])

Solution (Python):
n =int(input())
d = list(map(int,input().split()))

cnt = 0

d.sort()


print(d[int(n/2)] - d[int(n/2-1)])

Solution (Python):
N = int(input())
D = list(map(int, input().split()))
D.sort()
k = int(len(D)/2)
print(D[k]-D[k-1])

Solution (Python):

n = int(input())
d = list(map(int,input().split()))

a = sorted(d)

n2 = n//2
if a[n2-1] == a[n2]:
    print(0)
else:
    print(a[n2]- a[n2-1])

Solution (Python):
N = int(input())
X = list(map(int, input().split()))
X.sort()

if X[N//2 - 1] == X[N//2]:
    print(0)
    exit()

print(X[N//2] - X[N//2 - 1])

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
d.sort()
nn=int(n/2)-1
ansd=d[nn]
if d[nn]!=d[nn+1]:
    print(d[nn+1]-d[nn])
else:
    print(0)

Solution (Python):
N = int(input())
d = sorted(list(map(int, input().split())))
n_half = int(N / 2)
print(d[n_half:][0] - d[:n_half][-1])

Solution (Python):
K = int(input())
d = list(map(int,input().split()))
k_half = K // 2
d.sort()
if d[k_half] == d[k_half - 1]:
  print("0")
else:
  print(d[k_half] - d[k_half - 1])

Solution (Python):
N = int(input())
d = list(map(int, input().split()))

d = sorted(d)

print(d[N//2] - d[N//2-1])

Solution (Python):
N = int(input())
dl = list(map(int, input().split()))

dl.sort()
ans = 0

if len(dl) % 2 == 1:
    print(0)
else:
    i_mid = len(dl) // 2
    abc_max = dl[i_mid-1]
    arc_min = dl[i_mid]
    print(arc_min - abc_max)

Solution (Python):
import statistics
import math
n = int(input())
d = list(map(int,input().split()))
org_d = sorted(d)

median = statistics.median(org_d)

print(org_d[round(n/2)]-org_d[round(n/2-1)])

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
ds = sorted(d)
ind = int(n/2)
if ds[ind] == ds[ind-1]:
    print(0)
else:
    print(ds[ind]-ds[ind-1])

Solution (Python):
def resolve():
    n = int(input())
    dd = list(map(int, input().split()))

    size = len(dd) // 2
    dd.sort()
    ans = 0


    if dd[size] == dd[size - 1]:
        ans = 0
    else:
        ans = dd[size] - dd[size - 1]

    print(ans)
    
resolve()

Solution (Python):
N = int(input())
d = list(map(int,input().split()))


d.sort()

right = d[N // 2]
left = d[N // 2 - 1]

if left == right :
    print(0)
else :
    print(right - left)

Solution (Python):
N = int(input())
ddd = list(map(int, input().split()))

ddd = sorted(ddd)

ddd_mid1 = ddd[N // 2 - 1]
ddd_mid2 = ddd[N // 2]
print(ddd_mid2 - ddd_mid1)