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 = list(map(int, input().split()))

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

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

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

d = sorted(d)
half_num = len(d) // 2
ans = d[half_num] - d[half_num - 1]
print(ans)

Solution (Python):

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

d.sort()

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

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

import heapq

heapq.heapify(d)

for i in range(n//2-1):
	heapq.heappop(d)
	
a=heapq.heappop(d)
b=heapq.heappop(d)

print(b-a)

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()
diff = d[N//2]-d[N//2 -1]
print(diff)

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

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

centerl = int(len(m_L)/2-1)
centerr = int(len(m_L)/2)

print(sorted(m_L)[centerr] - sorted(m_L)[centerl])

Solution (Python):
if __name__ == '__main__':
    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())
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())))
ans = d[int(N/2)]-d[int(N/2)-1]
print(ans)

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())
d = list(map(int, input().split()))
d.sort()
print(d[int(n/2)] - d[int(n/2)-1])

Solution (Python):
n,*d=map(int,open(0).read().split())
d.sort()
print(d[n//2]-d[n//2-1])

Solution (Python):
def main():
    N, *d = map(int, open(0).read().split())
    d.sort()
    print(d[N // 2] - d[N // 2 - 1])
    return


main()

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    d = list(map(int, input().rstrip('\n').split()))
    d.sort()
    print(abs(d[n // 2] - d[n // 2 - 1]))


if __name__ == '__main__':
    slove()

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

if n % 2 != 0:
    print(0)

sorted_D = sorted(D)
left = sorted_D[int((n - 1) / 2)]
right = sorted_D[int(n / 2)]

if left == right:
    print(0)

else:
    print(right - left)

Solution (Python):


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

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

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

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


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

print(r-l)

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

d2=sorted(d)
l=(d2[int(n/2)-1])
r=(d2[int(n/2)])
print(r-l)

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
d_lis=sorted(d)
ans=0
if d_lis[n//2-1]==d_lis[n//2]:
  ans=0
else:
  ans=d_lis[n//2]-d_lis[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())
a=list(map(int,input().split()))

a=sorted(a)

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

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

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

d.sort()
l=d[N//2-1]
r=d[N//2]
print(r-l)

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

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

Solution (Python):
n = int(input())
d = [int(i) for i in 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()


d_len = len(d)

if d_len % 2 == 0:
    up = int(d_len/2)
    down = int(d_len/2) - 1
    if up == down:
        print('0')
    else:
        print(d[up]-d[down])
            
        

else:
    print('0')

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

D = sorted(d)

answer = 0
length = len(d)

if D[length//2-1] == D[length//2]:
    print(answer)
else:
    l = []
    i = D[length//2-1]
    while i+1 <= D[length//2]:
        l.append(i+1)
        i +=1
    answer = len(l)
    print(answer)

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

center = N / 2

x = sorted(D)

num = x[int(center)] - x[int(center)-1]
print(num)

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

result = d[center] - d[center - 1]

print(result)

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

h = int(n / 2)

x = d[h] - d[h - 1]

if x > 0:
  print(x)
else:
  print(0)

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


if __name__ == '__main__':
    main()

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

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

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

if N % 2 == 1:
    print(0)
else:
    d = sorted(d)
    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())
lst = [int(x) for x in input().split()]
lst.sort()

off = len(lst) // 2

front = lst[off - 1]
back = lst[off]

print(back-front)

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

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

d.sort()

center = N // 2

L = d[:center]
R = d[center:]



ans = R[0] - L[-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())
l = list(map(int, input().split()))
l = sorted(l)
start = l[(n // 2) - 1]
end = l[(n//2)]
print(max((end - start), 0))

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()
ARC = []
ABC = []

for i in range(N//2):
    ABC.append(d[i])
    ARC.append(d[-(i+1)])

boundaryARC = min(ARC)
boundaryABC = max(ABC)

if boundaryABC == boundaryARC:
    print(0)

else:
    print(boundaryARC-boundaryABC)

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

d_min=d[N//2-1]
d_max=d[N//2]

print(d_max-d_min)

Solution (Python):
import heapq
import sys
input = sys.stdin.readline


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

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


if __name__ == '__main__':
    main()

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

d.sort()

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

Solution (Python):
import numpy as np

n = int(input())
ds = list(map(int,input().split()))
ds.sort()
print(ds[n//2 ] - ds[n//2 - 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):
n=int(input())
d=sorted(list(map(int,input().split())))
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()
print(d[len(d)//2] - d[len(d)//2-1])

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

    d.sort()

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


if __name__ == '__main__':
    p_c()

Solution (Python):

import sys


def solve(N: int, d: "List[int]"):
    sorted_d = sorted(d)
    abc_max = sorted_d[N // 2 - 1]
    arc_min = sorted_d[N // 2]
    print(arc_min - abc_max)
    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()))
d_sort = sorted(d)
print(d_sort[N//2] - d_sort[N//2 - 1])

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

d.sort()
ans = 0
start_num = d[int(n / 2 - 1)]
end_num = d[int(n / 2)]

ans = end_num - start_num

print(ans)

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())
d = list(map(int, input().split()))
d.sort()
print(max(d[n//2]-d[n//2-1], 0))

Solution (Python):
import numpy as np
n = int(input())
d = [int(i) for i in input().split(" ")]
d = sorted(d)

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

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

if N % 2 == 1:
    print(0)
else:
    sed_d = sorted(d)
    sed_l = len(sed_d)
    l = sed_d[(sed_l//2)-1]
    r = sed_d[sed_l//2]
    K_list = list(range(l+1,r+1))
    print(len(K_list))

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())
a = sorted(list(map(int, input().split())))

ans = 0

for i in range(a[int((n/2)-1)], a[int(n/2)]):
  ans += 1

print(ans)

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

n = N//2 - 1
ans = D[n+1] - D[n]
print(ans)

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

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())
l=list(map(int, input().split()))
i=int(len(l)/2)
l.sort()
ll=list(range(l[i-1]+1,l[i]+1))

print(len(ll))

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

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

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

d_l = sorted(d_l)

m = d_l[(N//2) -1]
n = d_l[(N//2)]

print(n - m)

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

a.sort()

c1 = a[len(a)//2]
c2 = a[len(a)//2-1]
if c1 != c2:
    count = c1 - c2
print(count)

Solution (Python):
N = int(input())
d = sorted(list(map(int, input().split())))
min_K = d[N//2 - 1] + 1
max_K = d[N//2]
print(max_K - min_K + 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()))
sd = sorted(d, reverse=True)
print(abs(sd[int(len(sd)/2)-1]-sd[int(len(sd)/2)]))

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

if N%2==1:
    print(0)

di = sorted(list(map(int, input().split())))
first_of_center = di[int(len(di)/2)-1]
second_of_center = di[int(len(di)/2)]

if first_of_center == second_of_center:
    print(0)
else:
    print(second_of_center - first_of_center)

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
d.sort()
i = n // 2 - 1
ans = d[i+1] - d[i]
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 = sorted(list(map(int, input().split())))
i = n//2

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

Solution (Python):
import sys
input = sys.stdin.readline

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

Solution (Python):

import sys
input = sys.stdin.readline

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

l.sort()
i=n//2

if l[i]-l[i-1]==0:
    print(0)
else:
    print(l[i]-l[i-1])

Solution (Python):
from sys import stdin
import itertools

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
li.sort()
key = n//2
print(li[key:][0]-li[:key][-1])

Solution (Python):
from sys import stdin
import itertools

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
li.sort()
key = n//2

if li[:key][-1] == li[key:][0]:
    print(0)
else:
    print(li[key:][0]-li[:key][-1])

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

changed=sorted(s,reverse=True)


if changed[int(n/2-1)]==changed[int(n/2)]:
        print(0)
else:
        print(-changed[int(n/2)]+changed[int(n/2-1)])

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
d.sort()
mx = (N-1)/2 + 1/2
Mx = int(mx)
mn = (N-1)/2 -1/2
Mn = int(mn)
ans = d[Mx] - d[Mn]
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline

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):
from sys import stdin

N = int(stdin.readline())
d = sorted(list(map(int,stdin.readline().split())))

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

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

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

d.sort()

diff = d[n//2] - d[n//2-1]

print(diff)

Solution (Python):

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

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

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

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

d = list(map(int, input().split()))
d.sort()
c = 0
a = d[N//2 -1]
b = d[N//2]

for i in range(a+1,b+1):
  c +=1
  
print(c)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
 
if n % 2 == 1:
  print(0)
  exit()

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()
n = N//2
a = d[n-1]
b = d[n]
print(b-a)

Solution (Python):

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

d_list.sort()



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

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

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

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

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(i) for i in input().split()]
d.sort()
ans = d[N//2] - d[N//2 - 1]
print(ans)

Solution (Python):
N = int(input())
d = [int(i) for i in 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):
N = int(input())
d = [int(i) for i in 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):
n = int(input())

list_d = sorted(list(map(int, input().split())))

list_b = list_d[:int(n/2)]
list_r = list_d[int(n/2):]
print(len(list(range(list_b[-1] + 1, list_r[0] + 1))))

Solution (Python):
N = int(input())
d = sorted(list(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()))
if n %2 ==1:
    print(0)
else:
    d.sort()
    kmin = d[n//2-1]
    kmax = d[n//2]
    print(kmax - kmin)

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

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

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

a.sort()

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

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

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

ARC = d[int(N/2)]
ABC = d[int(N/2-1)]
ans = ARC - ABC

print(ans)

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

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

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

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=list(map(int,input().split()))

D=sorted(d)

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

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

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

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):
N = int(input())
d = list(map(int, input().split()))

d.sort()

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

Solution (Python):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


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

D.sort()
mid = N//2

count = 0
for i in range(D[mid-1]+1, D[mid]+1):
    count += 1

print(count)

Solution (Python):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


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

D.sort()
mid = N//2

if D[mid-1] == D[mid]:
    print(0)
    exit()

count = 0
for i in range(D[mid-1]+1, D[mid]+1):
    count += 1

print(count)

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

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

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

D_sorted = sorted(D)
sa = D_sorted[N // 2] - D_sorted[N // 2 - 1]
ans = sa
if ans <= 0:
    print(0)
else:
    print(ans)

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

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

a=sorted(m)

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

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

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

d = sorted(d)
a = d[n//2 - 1]
b = d[n//2]

print(b-a)

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left
from math import factorial


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


n = I()
L = sorted(LI())
if L[n // 2] == L[n // 2 - 1]:
    print(0)
else:
    print(L[n // 2] - L[n // 2 - 1])

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

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

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

d.sort()
print(len(range(d[n // 2 - 1] + 1, d[n // 2] + 1)))

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

t = sorted(l)

index = len(t)//2

ans = t[index] - t[index-1]

print(ans)

Solution (Python):


n = int(input())
d = sorted(list(map(int, input().split())))
c = n // 2
abc, arc = d[:c], d[c:]
ans = arc[0] - abc[-1]
print(ans)

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

d.sort()

div = N // 2

b_max = d[div - 1]
r_min = d[div]

print(r_min - b_max)

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

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

Solution (Python):
def main(): 

    N = int(input())
    d = sorted(map(int, input().split()))

    low_middle = len(d) // 2 - 1
    high_middle = len(d) // 2

    if d[low_middle] == d[high_middle]:
        print('0')
    else:
        print( d[high_middle] - d[low_middle])




if __name__ == "__main__":
    main()

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

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

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())
l = list(map(int, input().split()))
l = sorted(l)
a = l[n//2 - 1]
b = l[n//2]
 
print(b-a)

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

Solution (Python):

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

d.sort()
div_min = d[int(n/2-1)]
div_max = d[int(n/2)]

count = div_max - div_min
print(count)

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

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

Solution (Python):
def test():
    n = int(input())
    a = sorted(list(map(int,input().split())))
    b = a[n//2]; c = a[n//2-1]
    count = 0
    if sum(i<b for i in a) == sum(i>=b for i in a):
        print(b-c)
    else:
        print(0)


if __name__ == "__main__":
    test()

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
d.sort()
ans = d[int(n/2)] - d[int(n/2)-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 = list(map(int, input().split()))

d.sort()
n = N//2-1
if d[n] == d[n+1]:
    print(0)
    exit()
ans = 0
for i in range(d[n], d[n+1]):
    ans += 1
print(ans)

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

e = sorted(d)
if e[int(n/2)-1] == e[int(n/2)]:
	print(0)
else:
	print(e[int(n/2)]- e[int(n/2)-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):
while True:
    try:
        N = int(input())
        d = list(map(int, input().split()))
        d.sort()
        l = d[N//2-1]
        r = d[N//2]
        print(r-l)
    except:
        break

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

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

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

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

d.sort()

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

Solution (Python):
import sys

n = int(input())
d = list(map(int, input().split()))
dic = {}
val = 0

for i in range(n):
    if d[i] in dic.keys():
        dic[d[i]] += 1
    else:
        dic[d[i]] = 1

dic = sorted(dic.items())

if len(dic) == 1:
    print(0)
    sys.exit() 

for i in range(len(dic) - 1):
    val += dic[i][1]
    if val == n//2:
        ans = (dic[i][0], dic[i+1][0])
        print(ans[1] - ans[0])
        break
    elif val > n//2:
        print(0)
        break

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

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

Solution (Python):
N = int(input())
D = list(map(int,input().split()))
D.sort()
if N%2==1:
  print(0)
  exit()
a = N//2
print(len(list(range(D[a-1],D[a]))))

Solution (Python):

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

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

if d[int(n/2)] != d[int(n/2) - 1]:
  print(d[int(n/2)] - d[int(n/2) - 1])
elif d[int(n/2)] == d[int(n/2) - 1]:
  print(0)

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

if len(li)%2 == 1:
    print(0)
elif len(li)%2 == 0:
    l = li[len(li)//2-1]
    r = li[len(li)//2]
    print(r-l)

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

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

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

if n &1:
	print(0)
else:
	arr = list(map(int, strr.split()))

	arr.sort()
	mr = arr[n//2]
	ml = arr[(n//2)-1]
	print(mr-ml)

Solution (Python):
N = int(input())
nums = sorted(list(map(int, input().split())))
l = len(nums) // 2
res = nums[l] - nums[l - 1]
print(res)

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

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

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

Solution (Python):
n = int(input())
d_list = list(map(int, input().split()))
level_count_dic = {}
mid = int(n/2)
flag = True

for d in d_list:
    if d in level_count_dic:
        level_count_dic[d] += 1
    else:
        level_count_dic[d] = 1

sorted_level_count_dic = sorted(level_count_dic.items(), key=lambda x:x[0])

abc_count = 0
abc_max = 0

for k, v in sorted_level_count_dic:
    abc_count += v

    if abc_count == mid:
        abc_max = k+1
        break
    elif abc_count > mid:
        flag = False
        break


if flag:
    ans = 0
    while True:
        ans += 1
        if abc_max in level_count_dic:
            break
        abc_max += 1

    print(ans)
else:
    print(0)

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

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

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

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

Solution (Python):
N = int(input())
ds = list(map(int,input().split()))
sorted_ds = sorted(ds)
before = sorted_ds[N//2 - 1]
after = sorted_ds[N//2]
print(after - before)

Solution (Python):
import sys
import math
from copy import deepcopy
from collections import deque
sys.setrecursionlimit(20000000)


def main():
    S = int(input())
    nums = list(map(int, input().split()))
    nums.sort()

    print(nums[int(S/2)] - nums[int(S/2 - 1)])


if __name__ == '__main__':
    main()

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

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

print(ans)

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

d.sort()
ans = d[len(d) // 2] - d[len(d) // 2 - 1]
print(ans)

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

d = sorted(d)
l, r = d[n//2-1], d[n//2]
print(r-l)

Solution (Python):
import math
N = int( input() )
d = list( map( int, input().split() ) )
d = sorted(d)
c = N * 0.5
if math.ceil(c) != math.floor(c):
    print(0)
    exit()
print( d[int(c)] - d[int(c-1)] )

Solution (Python):
n = input()
a = sorted([int(x) for x in input().split(' ')])
d = int(len(a)/2)

print(len(range(a[d-1], a[d])))

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

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

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

for i in range(e[n//2-1],e[n//2]+1):
  if e[n//2-1] < i and i <= e[n//2]:
    cnt = cnt + 1
  
print(cnt)

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 = sorted(d)
ans = d[N//2]-d[N//2-1] 
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
import math

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

if len(ds) % 2 == 0:
    ds.sort()

    mid = math.floor(len(ds)/2)

    print(ds[mid]-ds[mid-1])
else:
    print(0)

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
d.sort()
ans = 0
if len(d) % 2 == 1:
    ans = 0
if len(d) % 2 == 0:
    med = int(len(d) / 2)
    if d[med] == d[med-1]:
        ans = 0
    else:
        for i in range(d[med-1]+1,d[med]+1):
            ans += 1
    
    
print(ans)

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

d = sorted(d)
half = int(n / 2)
ans = d[half] - d[half - 1]
print(ans)

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())
d = list(map(int,input().split()))
d.sort()
print(d[n//2]-d[n//2-1])