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-----
6
9 1 4 4 6 7

-----Sample Output-----
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.

Difficulty: introductory

Starter code:

Solutions:
n = int(input())
dn = list(map(int, input().split()))
dn.sort()
a = dn[n // 2 - 1]
b = dn[n // 2]

print((b-a))


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

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

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

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


# N/2番目に難しい問題が「ARC用の問題」かつ、
# N/2−1番目に難しい問題が「ABC用の問題」であればよい
# 難易度順に昇順でソート
# N/2番目の要素から、N/2−1番目の要素を引く

# 例d=[1,5,9,11,13,15,19,20]なら、答えは12,13の2つ
d = sorted(d)
print(d[N//2] - d[(N//2)-1])

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

d = {}
c = 0
for i in range(n):
    d[D[i]] = d.get(D[i],0)+1
a1 = -1
a2 = -1
for i in d:
    c += d[i]
    if c==n//2:
        a1 = i
    if c>n//2:
        a2 = i
        break
if a1==-1 or a2==-1:
    print(0)
else:
    print(a2-a1)

# coding: utf-8

def main():
    N = int(input())
    d = sorted(list(map(int, input().split())))
    ans = 0
    if d[N // 2] != d[N // 2 - 1]:
        ans = d[N // 2] - d[N // 2 - 1]

    print(ans)


def __starting_point():
    main()

__starting_point()

# -*- coding: utf-8 -*-
"""
Created on Thu Sep 10 14:46:16 2020

@author: liang
"""

N = int(input())
d = [int(x) for x in input().split()]
d.sort()
ans = d[N//2] - d[N//2 - 1 ]
print(ans)

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

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

s = int(len(d)/2)

if d[s] != d[s-1] :
    print(d[s]-d[s-1])
elif d[s] == d[s-1] :
    print(0)

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

import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    N = I()
    L = LI()
    L.sort()
    n = N //2
    
    l = L[n-1]
    r = L[n]
    print(r-l)
    
def __starting_point():
    main()
__starting_point()

# C
import math
N = int(input())
D = sorted(list(map(int, input().split())))
print((D[math.ceil((N)/2)] - D[math.ceil((N)/2)-1]))


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

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

print(right-left)

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

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


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

N, *D = map(int, open(0).read().split())

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

N = int(input())
D = list(map(int, input().split()))
sort = sorted(D)
left = sort[(N//2) -1]
right = sort[N//2]
print((right - left))


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

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

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

d.sort()
c = int(len(d) / 2)
l = d[:c]
r = d[c:]
print((r[0] - l[-1]))


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

d = sorted(d)
mid = N // 2
s = d[mid-1]
f = d[mid]
print(f-s)

N = int(input())
P = int(N/2)
A = list(map(int, input().split()))
A.sort()

S = A[P] - A[P-1]

print(S)


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

dlist_sorted = sorted(dlist)

kiwa_upper = dlist_sorted[n//2]
kiwa_low = dlist_sorted[(n//2)-1]

# 同じ数の選び方が存在しない場合
if len(dlist_sorted[n//2:]) != n//2:
    print(0)
# 存在する場合
else:
    print(kiwa_upper - kiwa_low)

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

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

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

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


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

input_num = int(input())
input_line = input().split()
input_line = [int(s) for s in input_line]
input_line.sort()

if(input_line[int(len(input_line)/2-1)] == input_line[int(len(input_line)/2)]):
    print((0))
else:
    print((input_line[int(len(input_line)/2)] - input_line[int(len(input_line)/2)-1]))


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

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


n = int(input())
d_l = list(map(int, input().split()))
d_l = sorted(d_l)
if len(d_l) %2 != 0:
    print(0)
else:
    idx = int(len(d_l)/2)
    abc = d_l[idx-1]
    agc = d_l[idx]
    print(agc-abc)

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

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

N = int(input())
d = sorted([int(i) for i in input().split()])
print(d[N//2] - d[(N//2)-1])

N = int(input())
a = list(map(int,input().split()))
a.sort()
half = int(len(a)/2)
if a[half-1] == a[half]:
  print(0)
else:
  print(a[half]-a[half-1])

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

N=int(input())
d=list(map(int,input().split()))
d.sort()
l=d[:N//2]
r=d[N//2:]

print(r[0]-l[-1])

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


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

d = sorted(d, reverse=True)
cent_index = int(n/2)-1

print(d[cent_index] - d[cent_index+1])

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

# ABC 132 C
N = int(input())
d = [int(i) for i in input().split()]
e = sorted(d)
print(e[int(N/2)] - e[int(N/2) - 1])

#ABC132 C

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

print(len(A))

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

d.sort()

# Odd pattern
if n % 2 == 1:
    print((0))
# Even pattern
else:
    ml = int(n / 2) - 1
    mr = int(n / 2)
    if d[ml] == d[mr]:
        print((0))
    else:
        print((d[mr] - d[ml]))


#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
n=int(input())
d=list(map(int,input().split()))
d.sort()
if d[n//2]-d[n//2-1]==0:
    print(0)
else:
    print(d[n//2]-d[n//2-1])

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


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

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

N = int(input())
ls = list(map(int, input().split(' ')))
ls.sort()
first_half = ls[: N // 2]
second_half = ls[N // 2 :]
if first_half[-1] == second_half[0]:
    print(0)
else:
    print(second_half[0] - first_half[-1])

n = int(input())
d = sorted(map(int, input().split()))
k1 = d[int(n/2)-1]+1
k2 = d[int(n/2)]
print(k2-k1+1)

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

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


import sys
N = int(input())
d = list(map(int, input().split()))

K_cnt = 0
dsort = sorted(d)

d_left = dsort[int(N/2)-1]
d_right = dsort[int(N/2)]

# ソートして中央値が一致した場合
# ぴったり同じにならない
if d_left == d_right:
    print(0)
else:
    print(d_right-d_left)

# AtCoder Beginner Contest 132
# C - Divide the Problems

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

d.sort()

l=d[(N//2)-1]
r=d[(N//2)]
if l==r:
    print((0))
    return

print((r-l))

# print(d)
# print(l,r)



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

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

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

print(right - left)

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

N = int(input())
d = list(map(int,input().split()))
d.sort()
dmed1 = N//2 - 1
dmed2 = N//2
ans = d[dmed2]-d[dmed1]
print(ans)

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

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

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

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

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

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

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

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

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

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

import math
import statistics
a=int(input())
#b=int(input())
# c=[]
# for i in b:
#     c.append(i)
# e1,e2 = map(int,input().split())
f = list(map(int,input().split()))
#j = [input() for _ in range(3)]
# h = []
# for i in range(e1):
#     h.append(list(map(int,input().split())))
f.sort()
tyu = statistics.median(f)
if f[len(f)//2]==f[len(f)//2-1]:
    print(0)
else:
    print(f[len(f)//2]-f[len(f)//2-1])

n = int(input())
d = list(map(int,input().split()))
s = sorted(d)
t = n//2
print(s[t]- (s[t-1]+1)+1)

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

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

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


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


#import math
#import itertools
#import numpy as np
#from collections import deque
# sys.setrecursionlimit(10 ** 6)
#MOD = 10 ** 9 + 7
#INF = 10 ** 9
#PI = 3.14159265358979323846

INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    n=INT()
    A=LIST()
    A=sorted(A)
    print(A[n//2]-A[n//2-1])
def __starting_point():
    do()
__starting_point()

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

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


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

import sys
input = sys.stdin.readline

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

n = int(input())
d = [int(x.strip()) for x in input().split()]
d_sorted = sorted(d)
m = int(n/2)
abc_fin = d_sorted[m-1]
arc_start = d_sorted[m]
if abc_fin == arc_start:
  ans = 0
else:
  ans = arc_start - abc_fin
print(ans)

from bisect import bisect_left

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

for i in range(1,10**5+1):
  p=bisect_left(d,i)
  ans+=1 if p==(n-p) else 0

print(ans)

N =int(input())

A = list(map(int, input().split()))
A.sort()
divide = len(A)//2

ans = A[divide] - A[divide-1]
print(ans)

n = int(input())
d = list(map(int,input().split()))
c = 0
d.sort()
n = int(n/2)

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

N = int(input())
d = list(map(int, input().split()))
d = sorted(d)
if N % 2 != 0:
  print(0)
else:
  x = N // 2
  ans = d[x] - d[x-1]
  print(ans)

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

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

half = n//2
first = d[half - 1]
second = d[half]

print(second - first)

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

d.sort()
i1 = N // 2
i2 = N // 2 - 1

result = d[i1] - d[i2]
print(result)

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

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


#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    exams=[]
    sorted_exams=[]
    n = int(input())
    exams=list(map(int,input().split()))
    sorted_exams=sorted(exams)
    half=n//2

    start=sorted_exams[half-1]
    end=sorted_exams[half]

    print(end-start)

def __starting_point():
    main()
__starting_point()


def main():

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

def __starting_point():
    main()


__starting_point()

n = int(input())
p = list(map(int, input().split()))
nn = int(n/2)
p.sort()
ans = p[nn] - p[nn-1]

print(ans)

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


class Solution:
    def __init__(self,n,dn):
        self.n = n
        self.dn = dn
    
    def __reverse(self):
        self.dn.sort()
        return self.dn
    
    def answer(self):
        self.dn = self.__reverse()
        a = self.dn[self.n // 2 - 1]
        b = self.dn[self.n // 2]
        print((b - a))


conditions = Solution(n,dn)
conditions.answer()


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

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

d.sort()

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

n=int(input())
d =list(map(int,input().split()))
d.sort()
ans = 0
for i in range(1,10**5+1):
        if d[n//2-1] <i and d[n//2] >=i:
                ans +=1

print(ans)

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

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

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

N = int(input())
ls = list(map(int, input().split(' ')))
ls.sort()
first_half = ls[: N // 2]
second_half = ls[N // 2 :]
if first_half[-1] == second_half[0]:
    print(0)
else:
    print(second_half[0] - first_half[-1])

n = int(input())
dn = list(map(int, input().split()))
dn.sort()
a = dn[n // 2 - 1]
b = dn[n // 2]

cnt = 0
for i in range(a, b):
    cnt += 1

print(cnt)


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

# -*- coding:utf-8 -*-
N = int(input())
d = list(map(int,input().split()))

half = N//2
d.sort()

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

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

ans = ary[int(len(ary)/2)] - ary[int(len(ary)/2) -1]
print(ans)


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

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


N = int(input())
d = list(map(int, input().split()))
p = [0] * N
for i in range(N):
    p[i] = (d[i], i)
p.sort()
result = abs(p[N//2][0] - p[N//2-1][0])
# print(p)
print(result)

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

n =int(input())
x = sorted(map(int,input().split()))
print(x[len(x)//2]-x[len(x)//2-1])

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


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