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

Solution (Python):

import os
import sys
from io import BytesIO, IOBase


def main() -> None:
    input()
    arr = list(map(int, input().split()))

    cnt = [0] * (10 ** 5 + 10)
    for i in arr:
        cnt[i] += 1

    for i in range(len(cnt) - 2, -1, -1):
        cnt[i] += cnt[i+1]

    print(cnt.count(len(arr) // 2))



BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self, **kwargs):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")



if __name__ == "__main__":
    main()

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

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

Solution (Python):
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])

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

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

print(right - left)

Solution (Python):
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])

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

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

Solution (Python):


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))

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

Solution (Python):
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)

Solution (Python):









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])
if __name__=='__main__':
    do()

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

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

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

Solution (Python):
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)

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())
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])

Solution (Python):
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(result)

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

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

Solution (Python):

def main():

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

if __name__ == "__main__":
    main()

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

Solution (Python):
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)

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

Solution (Python):
n=int(input())
L=sorted(list(map(int,input().split())))
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


def solve(N: int, d: "List[int]"):
    d.sort()
    abc = d[int(N/2)-1]
    arc = d[int(N/2)]
    print(arc-abc)

    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):

import sys


def solve(N: int, d: "List[int]"):
    b = [0] * (10**5 +1)
    for i in range(N):
        b[d[i]] += 1
    t = 0
    f = False
    ans = 0
    for i in range(1, 10 ** 5 + 1):
        if not f:
            t += b[i]
            if t == N / 2:
                f = True
            elif t > N / 2:
                ans = 0
                break
        else:
            ans += 1
            if b[i] != 0:
                break
    print(ans)



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

Solution (Python):
import sys


def main():
    input = sys.stdin.buffer.readline
    n = int(input())
    d = sorted((map(int, input().split())))
    print(d[n // 2] - d[n // 2 - 1])


if __name__ == "__main__":
    main()

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

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

d.sort()


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

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

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

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

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

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())))

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

Solution (Python):
n=int(input())
d=[int(x) for x in input().split()]
if n%2==1:
    print(0)
    exit()
d.sort()
print(d[n//2]-d[n//2-1])

Solution (Python):
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)

Solution (Python):
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])

Solution (Python):

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

half = N//2
d.sort()

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

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

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

print(ans)

Solution (Python):
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)

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

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

print(second - first)

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

Solution (Python):



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)
    exit()

print(r-l)

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

Solution (Python):


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)


if __name__ == "__main__":
    main()

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

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

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

Solution (Python):
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)])

Solution (Python):

"""
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)

Solution (Python):
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)

Solution (Python):
N, *D = map(int, open(0).read().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()
s=d[n//2]-d[n//2-1]
print(s)

Solution (Python):

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

Solution (Python):
import math
import statistics
a=int(input())





f = 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])

Solution (Python):
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)

Solution (Python):

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)

if __name__=="__main__":
    main()

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

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

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

Solution (Python):
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)

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

Solution (Python):
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)

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())))

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

Solution (Python):
n =int(input())
a = list(map(int,input().split()))
b = sorted(a)
if b[len(a)//2-1] != b[len(a)//2]:
  print(b[len(a)//2]-b[len(a)//2-1])
else:
  print(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()
a = D[n//2]
b = D[n//2-1]
print(a-b)

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

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

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

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

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

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

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

Solution (Python):
N=int(input())
d=sorted(list(map(int,input().split())))
l=len(d)
a=d[int(l/2)]
b=d[int(l/2)-1]
x=0
for i in range(b,a):
    x+=1
print(x)

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

x = d[N//2 - 1]
y = d[N//2]

print(y-x)

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

x = d[N//2 - 1]
y = d[N//2]

print(0 if x == y else y-x)

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

ans = d[N//2] - d[N//2-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):
import numpy as np

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

med = np.median(d)
if med in d:
  print(0)
  
else:
  lar = [x for x in d if x>med]
  sma = [x for x in d if x<med]

  print(lar[0]-sma[-1])

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

List.sort()
divideNum=N//2
print(List[divideNum] - List[divideNum-1])

Solution (Python):
N = int(input())
N_List = sorted(list(map(int,input().split())))
std = int(N/2)
ansstd = N_List[std] - N_List[std-1] 
print((0,ansstd)[ansstd > 0])

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

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

Solution (Python):
n = int(input())
Ds = list(map(int, input().split()))
L1 = [0] * (10 ** 5 + 1)
L2 = [0] * (10 ** 5 + 1)
for d in Ds:
  L1[d] += 1
L2[0] = L1[0]
for i in range(1,10 ** 5 +1):
  L2[i] = L1[i] + L2[i - 1]
print(L2.count(n //2))

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

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

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

Solution (Python):
a=int(input())
b=list(map(int,input().split()))
"""
import statistics
import math
median = statistics.median(b) 中央値出そうとした
print(median)
"""
b.sort()
c=int(a/2)
print(b[c]-b[c-1])

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

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

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

Solution (Python):
n=int(input())
d=[int(x) for x 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()
print(d[n//2]-d[n//2-1])

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

    sort_d = sorted(d)

    median_index = int(n/2)

    median_d = sort_d[median_index]
    median_d_minus1 = sort_d[median_index-1]

    answer = median_d - median_d_minus1
    print(answer)


if __name__ == '__main__':
    main()

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

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())
s = list(map(int, input().split()))
s.sort()
x = n // 2
print(s[x] - s[x - 1] if s[x] != s[x - 1] else 0)

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

    d_lst.sort()

    ans = d_lst[n // 2] - d_lst[n // 2 - 1]

    print(ans)


if __name__ == "__main__":
    main()

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

    d_lst.sort()

    if d_lst[n // 2 - 1] == d_lst[n // 2]:
        ans = 0
    else:
        ans = d_lst[n // 2] - d_lst[n // 2 - 1]

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

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

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):
def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    n = int(input())
    a = Input()
    sorted_a = sorted(a)
    point = max(a)//2
    center_index = len(a)//2
    right = sorted_a[center_index:]
    left = sorted_a[:center_index]
    print((point) - max(left) + min(right)-point)



main()

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

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readlines

def main():
    lines = input()

    n = int(lines[0].strip())
    a = list(map(int, lines[1].split()))

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

    print(d-c)

main()

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

lev_s = sorted(lev)
ans = 0

if lev_s[n//2] == lev_s[n//2 - 1]:
  print(0)
else:
  print(abs(lev_s[n//2] - lev_s[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
from collections import deque
import numpy as np
import math
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def solve():
    mid = n//2
    print(d[mid]-d[mid-1])
    return

if __name__=='__main__':
    n = I()
    d = sorted(list(IL()))
    solve()

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

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()

th1 = d[N//2-1]
th2 = d[N//2]

print(th2 - th1)

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

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

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

M = N//2
ans = D[M] - D[M-1]

if D[M] == D[M-1]:
  ans = 0

print(ans)

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

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

tmp = n//2

if sort_d[tmp-1]==sort_d[tmp]:
    print(0)
else:
    print(sort_d[tmp]-sort_d[tmp-1])

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

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

Solution (Python):
import sys
import numpy as np
import numba
from numba import jit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@jit
def main(n, d):
  d_sort = np.sort(d)
  num = len(d_sort)//2
  return d_sort[num]-d_sort[num-1]


n = int(readline())
d = np.array(readline().split(), np.int64)


print(main(n, d))

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

abc = d[:l//2]
arc = d[l//2:]

if abc[-1] == arc[0]:
    print(0)
    exit()
    
print(arc[0] - abc[-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[int(N/2)] - d[int(N/2) - 1])

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

difficulties.sort()
first_half = difficulties[:int(n/2)]
second_half = difficulties[int(n/2):]

ans = second_half[0] - first_half[-1]

print(ans)

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

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

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

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

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

Solution (Python):
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy


import heapq
sys.setrecursionlimit(10**6)

INF = 10**18
import bisect
import statistics
mod = 10**9+7


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

d = sorted(d)

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

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

sorted_D = sorted(D)

f = N//2 - 1
s = f + 1

print(sorted_D[s]-sorted_D[f])

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

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

sort_d = sorted(d)

abc = sort_d[N//2-1]
arc = sort_d[N//2]

print(arc-abc)

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

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

d.sort()

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

if a==b:
  print('0')

else:
  print(a-b)

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

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

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

Solution (Python):




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

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

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    d=LI()
    d.sort()
    a=d[N//2-1]
    b=d[N//2]
    ans=b-a
    print(ans)

main()

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

print(ans)

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

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

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

d = sorted(d)

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

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

Solution (Python):
def main():
  N = int(input())
  if N % 2 == 1:
    print(0)
    return 0
  
  num = int(N/2)
  D = list(map(lambda d: int(d), input().split(" ")))
  D.sort()
  
  difficultABC = D[int(N/2) - 1]
  easyARC = D[int(N/2)]

  print(easyARC - difficultABC)

main()

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

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

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

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

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

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