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):
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
import itertools
from collections import Counter

def main():
    n = int(input())
    d = list(map(int, input().split()))
    d.sort()
    mid = n//2-1
    left = d[mid]
    right = d[mid+1]
    print(right-left)


if __name__=="__main__":
    main()

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,string
from collections import defaultdict as D
from functools import reduce
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


N = I()
d = LI()

d.sort()

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


print(ans)

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

d_sort = sorted(d)
d_med1 = d_sort[len(d)//2-1]
d_med2 = d_sort[len(d)//2]
print(d_med2-d_med1)

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)
l=D[N//2-1]
r=D[N//2]
print(r-l)

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

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

Solution (Python):
import statistics as st

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

c1 = st.median_low(d)
c2 = st.median_high(d)

print(abs(c1-c2))

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
d.sort(key=int)
if d[int(n/2)]==d[int(n/2)-1]:
  print(0)
else:
  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())
d = list(map(int,input().split()))
d_sorted = sorted(d, reverse = False)

count = d_sorted[(N-1) //2 + 1] - d_sorted[(N-1) // 2]
print(count)

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

t=N//2
print(dd[t]-dd[t-1])

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    d = LI()
    d.sort()

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

if __name__ == '__main__':
    resolve()

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

Solution (Python):
N=int(input())
l=[int(i) for i in input().split()]
l.sort()
print(max(0,l[int(N/2)] - l[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()))
d=sorted(d)
m=n//2
print(d[m]-d[m-1])

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

d = sorted(d)

idx = int(N/2)

l = d[:idx][-1]
r = d[idx:][0]

print(r - l)

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[int(n/2)] - d[int(n/2)-1])

Solution (Python):
from sys import stdin

n = int(stdin.readline().strip())
d_lst = sorted([int(x) for x in stdin.readline().strip().split()])

bef = d_lst[len(d_lst)//2-1]
aft = d_lst[len(d_lst)//2]

print(aft - bef)

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

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

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

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

for i in range(N):
    D[i]=(D[i],i)
D=sorted(D)
print(D[N//2][0]-D[N//2-1][0])

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

print(sd[N//2]-sd[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 = sorted(D)
print(D[n // 2] - D[n // 2 - 1])

Solution (Python):
import math
n=int(input())
a=[int(i) for i in input().split()]
a=sorted(a)
c=(len(a)//2)-1
if(a[c+1]==a[c]):
    print(0)
else:
    print(abs(a[c]-a[c+1]))

Solution (Python):
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instr = lambda: sys.stdin.readline()
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()
D = inintl()

D.sort()

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

Solution (Python):
N = int(input())
D = sorted(map(int,input().split()))
print(max(0,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[int(N/2)]-D[int(N/2)-1])

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

cnt = 0
import bisect
for k in range(1,d[n-1]+1):
    if bisect.bisect_left(d,k) == n//2:
        cnt += 1
        
        
print(cnt)

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

halfLength = int(len(sorted_d) / 2)

if sorted_d[halfLength-1] ==  sorted_d[halfLength]:
	print(0)
else:
	print(sorted_d[halfLength] - sorted_d[halfLength-1])

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

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

d.sort()

n = int(N / 2)

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

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

num = d[N // 2 - 1]
ans = 0
for i in range(10**5):
    num += 1
    if d[N // 2 - 1] < num <= d[N//2]:
        ans += 1
    if num > d[N//2]:
        break
print(ans)

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

d.sort()

n = N // 2

t1 = d[n - 1]
t2 = d[n]

print(t2 - t1)

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

ds.sort()

d_miman = ds[N // 2 -1]
d_ijyou = ds[N // 2]

print(d_ijyou - d_miman)

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

a.sort()

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

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

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

d = sorted(d)

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

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

if 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()))
d.sort()
a = n//2
if d[a] == d[a-1]:
    print(0)
    exit()
print(d[a] - d[a-1])

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

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()
n //= 2

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
Ds = list(mapint())
Ds.sort()
MIN = Ds[N//2-1]
MAX = Ds[N//2]

if MIN==MAX:
    print(0)
else:
    print(MAX-MIN)

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

Solution (Python):
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())
l=lnii()
l.sort()

inx=n//2-1
print(l[inx+1]-l[inx])

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

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

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

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())
N2 = int(N/2)
d = [int(x) for x in input().split()]
d.sort()

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

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

Solution (Python):


def main():

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

    d.sort()

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

    print(ans)


if __name__ == "__main__":
    main()

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

Solution (Python):





























































global FLAG_LOG
FLAG_LOG = False


def log(value):
    
    
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    
    N = int(lines[0])
    
    values = list(map(int, lines[1].split()))
    
    
    
    
    
    
    

    values.sort()
    n = int(N/2)

    log(f'values=[{values}]')
    result = values[n] - values[n-1]

    return [result]



def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines



def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['6', '9 1 4 4 6 7']
        lines_export = [2]
    if pattern == 2:
        lines_input = ['8', '9 1 14 5 5 4 4 14']
        lines_export = [0]
    if pattern == 3:
        lines_input = ['14', '99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1']
        lines_export = [42685]
    return lines_input, lines_export



def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode



def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    
    
    
    
    
    
    
    
    
    
    



if __name__ == '__main__':
    main()

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

Solution (Python):
ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import math
import itertools
import heapq as hq
gcd = math.gcd
n = ni()
D = list(ma())
D.sort()
print(D[n//2] - D[(n-1)//2])

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(max(0,d[N//2]-d[N//2-1]))

Solution (Python):
import sys
N = int(input())
d = list(map(int, input().split()))
if len(d) % 2 != 0:
    print(0)
    sys.exit()
d.sort()
if d[N//2] == d[N//2-1]:
    print(0)
else:
    print(d[N//2] - d[N//2-1])

Solution (Python):
import sys
from io import StringIO
import unittest


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

    d.sort()

    l = d[n // 2 - 1]
    r = d[n // 2]

    print(r - l)


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """6
9 1 4 4 6 7"""
        output = """2"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """8
9 1 14 5 5 4 4 14"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """14
99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1"""
        output = """42685"""
        self.assertIO(input, output)


if __name__ == "__main__":
    
    resolve()

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

d1,d2=d[N//2-1],d[N//2]
print(d2-d1)

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

Solution (Python):
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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())))
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):
_ = input()
D = [int(i) for i in input().split()]

D.sort()
l = len(D)
lower = D[(l // 2) - 1]
upper = D[(l // 2)]

print(upper - lower)

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

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

Solution (Python):
N = int(input())
li = list(map(int, input().split()))
li.sort()
a = li[N//2]
flag = True
for i in range (N//2):
    if a == li[i]:
        flag = False
if flag:
     print(li[N//2]-li[N//2-1])
else:
     print(0)

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

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

d.sort()
n = N // 2

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

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

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


import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    n = ni()
    d = na()
    d.sort()
    dl = d[n//2-1]
    dr = d[n//2]
    if dl == dr:
        print(0)
    else:
        print(dr - dl)

if __name__ == "__main__":
    main()

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

d.sort()

s = d[N//2-1]
e = d[N//2]
K = e - s 
print(K)

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

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

def main(n,d):
    ds=sorted(d)
    m=n//2
    if ds[m-1]==ds[m]:
        return 0
    else:
        return ds[m]-ds[m-1]

if __name__=='__main__':
    n,d=readinput()
    ans=main(n,d)
    print(ans)

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

Solution (Python):
N = int(input())
d = list(sorted(map(int, input().split())))
K_high = d[N//2]
K_low = d[N//2-1] + 1
print(K_high-K_low+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=sorted(list(map(int,input().split())))
print(max(0, d[n//2]-d[n//2-1]))

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

Solution (Python):
N = int(input())
D = list(map(int, input().split()))
dic = {}
ABCs = 0
count = 0
flag = 0

for i in range(N):
    if D[i] in dic:
        dic[D[i]] += 1
    else:
        dic[D[i]] = 1

diffs = sorted(dic.keys())

for k in range(diffs[-1]+1):
    if flag == 0:
        if ABCs == N / 2:
            count += 1
            flag += 1
    else:
        if ABCs > N / 2:
            break
        count += 1

    if k in dic:
        ABCs += dic[k]

print(count)

Solution (Python):
N = int(input())
D = list(map(int, input().split()))
dic = {}
ABCs = 0
count = 0

for i in range(N):
    if D[i] in dic:
        dic[D[i]] += 1
    else:
        dic[D[i]] = 1

diffs = sorted(dic.keys())

for i in range(diffs[-1]+1):
    if i in dic:
        ABCs += dic[i]
    if ABCs == N / 2:
        count += 1

print(count)

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

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


if __name__ == '__main__':
    main()

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

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

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

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

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

Solution (Python):
def main():
    n = int(input())
    inlis = list(map(int,input().split()))
    inlis.sort()

    left = inlis[int(n//2)-1]
    right = inlis[int(n//2)]

    print(right-left)

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

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

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

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

left = N // 2 - 1
right = N // 2

ans = D[right] - D[left]
print(ans)

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, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

N = ri()
D = rl()

D.sort()

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

d1 = D[N//2-1]
d2 = D[N//2]
if d1 == d2:
	print(0)
	exit()

print(d2-d1)

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

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

Solution (Python):







__giturl__ = "$URL$"


from sys import stdin
input = stdin.readline


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

  D = sorted(D)
  l = D[len(D)//2-1]
  r = D[len(D)//2]

  print(r-(l+1)+1)


if(__name__ == '__main__'):
  main()

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

Solution (Python):
import sys


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


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




if __name__ == "__main__":
    main()

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

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

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

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

  
left = dl[(n//2)-1]
right = dl[(n//2)]

print(right-left)

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

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

print(ans)

Solution (Python):

def input_array():
	return list(map(int,input().split()))

n=int(input())
d=input_array()
d.sort()
center=int(n/2)
ans=d[center] - d[center -1] 

print(ans)

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

half = int(n/2)

n1 = d[half-1]
n2 = d[half]

if n2-n1 == 0:
    print(0)
    exit()
else: 
    print(n2-n1)

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

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

d = sorted(d)

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

Solution (Python):

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

d.sort()

h = int(N/2)

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

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

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

print(result)

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

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





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




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

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

Solution (Python):
N = int(input())
number = list(map(int,input().split()))
number.sort(reverse=True)
a = int((N/2)-1)
b = int(N/2)
print(number[a]-number[b])

Solution (Python):

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

if __name__ == "__main__":
    N = int(input())
    d = list(map(int, input().split()))
    d.sort()
    solve()

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

new_l = sorted(l)
half1 = new_l[N//2-1]
half2 = new_l[N//2]

print(half2-half1)

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

new_l = sorted(l)
half1 = new_l[N//2-1]
half2 = new_l[N//2]

if half1 == half2:
    print(0)
else:
    print(half2-half1)

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

Solution (Python):
def main():
    N = int(input())
    D = sorted(list(map(int, input().split())))
    a = D[N//2 - 1]
    b = D[N//2]
    ans = 0
    if a < b:
        ans = b - a
    print(ans)


if __name__ == '__main__':
    main()

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

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

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()
res = D[(N - 1) // 2 + 1] - D[(N - 1) // 2]
print(res)

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

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

Solution (Python):
N = int(input())
D = input().split(' ')
D = [int(D[i]) for i in range(N)]
D = sorted(D)
if not N%2 == 0:
  print(0)
else:
  print(D[int(N/2)] - D[int(N/2) - 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 = sorted(list(map(int, input().split())))

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

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

if not dl%2 == 0:
    print(0)
    exit()
else:
    dl_mid_1 = dl//2
    dl_mid_2 = dl_mid_1 + 1
    k_min = d[dl_mid_1 - 1]
    k_max = d[dl_mid_2 - 1]
    print(k_max - k_min)

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

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

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

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=sorted(d)
ans=0
 
for i in range(1+10**5):
    if d[int(N/2-1)] < i and i <= d[int(N/2)]:
        ans +=1
 
print(ans)

Solution (Python):
N=int(input())
d=list(map(int, input().split()))
 
d=sorted(d)
ans=0
 
for i in range(10**6):
    if d[int(N/2-1)] < i and i <= d[int(N/2)]:
        ans +=1
 
print(ans)

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

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

print(ans)

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
ans=0
di=sorted(d)
half1=di[(n-1)//2]
half2=di[(n-1)//2+1]
ans=half2-half1
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):
def resolve():
    '''
    code here
    '''
    N = int(input())
    Ds = [int(item) for item in input().split()]

    Ds.sort()

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


if __name__ == "__main__":
    resolve()

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

def main():
    n = int(input())
    d = sorted(list(map(int, input().split())))
    print(d[n//2]-d[n//2-1])
    
if __name__ == '__main__':
    main()

Solution (Python):
from math import gcd
n=int(input())
d=list(map(int,input().split()))

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

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

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

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

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

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

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