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 sys
def input(): return sys.stdin.readline().strip()
def gcd(x, y): return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y): return (x * y) // gcd(x, y)

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




D.sort()

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

Solution (Python):
import sys,collections,math,random;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n = I()
lis = Is()
lis = sorted(lis)
print(lis[n//2]-lis[n//2 -1])

Solution (Python):

from collections import defaultdict
import math
import re

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

    D = sorted(D)

    middle = N // 2
    lower = D[middle-1]
    higher = D[middle]

    num = higher - lower
    print(num)



if __name__ == '__main__':
    main()

Solution (Python):




def solve():
    N = int(input())
    D = sorted(list(map(int, input().split())))
    mid = N // 2
    return D[mid] - D[mid - 1]
    

def main():
    print(solve())


if __name__ == "__main__":
    main()

Solution (Python):
import sys
from collections import deque

readline = sys.stdin.readline

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

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

Solution (Python):

N=int(input())
x=list(map(int,input().split()))
n=N//2

X=sorted(x)





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

Solution (Python):
import sys
sys.setrecursionlimit(4100000)
n = int(input())
d = [int(i) for i in input().split()]
d.sort()
half = n//2
ans = 0
if n%2 == 0:
    if d[half] == d[half-1]:
        ans = 0
    else:
        ans = d[half]-d[half-1]
else:
    ans = 0
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 = [int(i) for i in 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=list(map(int,input().split()))
x=[0]*(10**5+1)
for d in D:
    x[d]+=1
a=0
for i in range(10**5):
    x[i+1]+=x[i]
    if x[i+1]==N//2:
        a+=1
print(a)

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

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

Solution (Python):
N = int(input())
d =list(map(int,input().split()))
d = sorted(d)
index = int(N/2)-1
print(len(range(d[index],d[index+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(map(int, input().split()))
print(d[(n-1)//2+1] - 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()
ans = 0
if d[N//2] == d[N//2 - 1]:
    ans = 0
else:
    ans = d[N//2] - d[N//2 - 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):
def main():
    N = int(input())
    d = list(map(int, input().split()))
    d.sort()
    return d[N // 2] - d[N // 2 - 1]

print(main())

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

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

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


d.sort()

ans = 0
for i in range(1, 100100):
    tmp = bisect.bisect_left(d, i)
    if N - tmp == tmp:
        ans += 1
print(ans)

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

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

Solution (Python):



import sys
from collections import defaultdict

N = int(input())
A = sorted(list(map(int, input().rstrip().split(' '))))

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

Solution (Python):

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

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

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

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

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

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

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

d_list.sort()


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

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

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

d.sort()

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

print(max(right-left, 0))

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

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

Solution (Python):


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

M = N // 2

d = sorted(d)

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

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

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

li.sort()

if n % 2 == 0:
    s = n//2
    ans = li[s] - li[s-1]

print(ans)

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

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

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

left_key = ds[int(N/2-1)]
right_key = ds[int(N/2)]
print(right_key-left_key)

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

cen = N//2-1

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

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

Solution (Python):
N = int(input())
*D, = 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()
mid = n // 2
print(d[mid] - d[mid-1])

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

d_list.sort()
from bisect import bisect_right
ans = 0

for i in range(1, max(d_list)):
    idx = bisect_right(d_list, i)
    if N //2 == idx:
        ans += 1
print(ans)

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

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

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

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

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

Solution (Python):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
k = na()
k = sorted(k)
m = n//2

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

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

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

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

D.sort()

m = int(N/2)

print(D[m] - D[m-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 = list(map(int,input().split()))

d.sort()


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

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

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

Solution (Python):
n = int(input())
d = sorted(list(map(int, input().split())),reverse=True)
m = n//2

print(-d[m]+d[m-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 numpy as np

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

d.sort()
lower = n // 2 - 1
upper = n // 2

comb = d[upper] - d[lower]

print(comb)

Solution (Python):
def m():
    N = int(input())
    D = [int(i) for i in input().split()]
    D.sort()
    left = D[N // 2 - 1]
    right = D[N // 2]
    if left == right:
        return 0
    return right - left


print(m())

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()))
    D.sort()
    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())))

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

"""
AtCoder A
"""

import sys, math, random
import numpy as np







 
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
 
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    N = I()
    D = LI()
    D.sort()
    half=int(N/2-1)
    print(D[half+1]-D[half])

    
if __name__ == "__main__":
    main()

Solution (Python):
import bisect as b

N = int(input())
P = list(map(int, input().split()))
P.sort()
S = list(set(P))
S.sort()

res = 0
for n, s in enumerate(S):
    i = b.bisect_right(P, s)
    if i == N // 2:
       res = S[n + 1] - s
    elif i > N // 2:
        break

print(res)

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

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

Solution (Python):
import bisect
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, b = D[N//2-1], D[N//2]

print(b-a)

Solution (Python):
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]


def get_nums_l():
    return [ int(s) for s in input().split(" ")]


def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

n = int(input())
ds = sorted(get_nums_l())

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

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

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

li.sort()

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

Solution (Python):
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())
ds = [int(i) for i in input().split()]
ds = sorted(ds)
print(ds[N//2] - ds[N//2-1])

Solution (Python):
n=int(input())
p=input().rstrip().split(' ')
p.sort(key=int)
print(int(p[len(p)//2]) - int(p[(len(p)//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([int(x) for x in 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()
l = int(n/2)
print(d[l]-d[l-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()
print(D[N//2] - D[N//2-1])

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

dlow = d[N // 2 - 1]
dhieh = d[N // 2]

print(dhieh - dlow)

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


rl = lambda: map(int,input().split())
rr = lambda N: [list(l) for l in zip(*[rl() for _ in range(N)])]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
MOD = 10**9+7

N = ri()
D = list(rl())
D.sort()
print(D[N//2]-D[N//2-1])

Solution (Python):
from collections import Counter


def solve(N, Ps):
    C = Counter(Ps)
    M = 10 ** 5 + 1
    counts = [0 for i in range(M)]
    for d, c in sorted([(d, c) for d, c in C.items()], key=lambda x: x[0]):
        counts[d] += c

    for i in range(1, M):
        counts[i] += counts[i - 1]

    return len([c for c in counts if c == N // 2])


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

Solution (Python):


import sys

n= int(sys.stdin.readline())
d= [ int(x) for x in sys.stdin.readline().split() ]
d.sort()

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

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

l.sort()

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

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

"""
Created on Sat Jun 29 20:53:11 2019

@author: Yamazaki Kenichi
"""

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

d.sort()

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

print(ans)

Solution (Python):

import sys


def solve(N: int, d: "List[int]"):
    d.sort()
    print(d[N // 2] - d[N // 2 - 1])
    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):
from heapq import heappush, heappop
import re
from collections import deque
import sys
input = sys.stdin.readline


def int_raw():
    return int(input())


def ss_raw():
    return input().split()


def ints_raw():
    return tuple(map(int, ss_raw()))


DIV = 10**9+7


def mod_invs(n, mod=DIV):
    inv = [0]*(n+1)
    inv[0] = 1
    inv[1] = 1
    for i in range(2, n+1):
        inv[i] = (-(mod//i)*inv[mod % i]) % mod
    return inv


def main():
    N = int_raw()
    ds = list(ints_raw())
    ds.sort()
    medi = ds[(N-1)//2]
    medi_h = ds[(N-1)//2+1]
    return medi_h-medi


print(main())

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

Solution (Python):


N = int(input())
d = sorted([int(i) for i in 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 = [int(item) for item in input().split()]
d.sort()

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

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

dlist.sort()


min_arc=dlist[N//2]
max_abc=dlist[N//2-1]

print(min_arc-max_abc)

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


if __name__ == '__main__':
	main()

Solution (Python):
N = int(input())
d = [int(i) for i in input().split()]
d = sorted(d)
print(len(list(range(d[N//2-1], d[N//2]))))

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

mid = N//2

print(D[mid] - D[mid-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()

n = N // 2

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

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

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

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

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

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

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

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

fin = sys.stdin.readline

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

d = sorted(d)

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

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

print(sorted(d)[n//2]-sorted(d)[0:n//2][-1])

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 = [int(x) for x in input().split()]

d.sort()

abc_max, arc_min = d[len(d)//2 - 1], d[len(d)//2]


print(arc_min - abc_max)

Solution (Python):


def readInts():
  return [int(s) for s in input().split(" ")]

def main():
  N = readInts()[0]
  d = readInts()
  d.sort()

  l = N // 2 - 1
  r = N // 2

  print(d[r] - d[l])


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

d.sort()
t = N // 2

print(d[t] - d[t-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())
a = list(map(int, input().split()))
res=0

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

Solution (Python):
raw_input()
s = sorted(map(int, raw_input().split()))

i = len(s) / 2

print s[i] - s[i-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):
N = int(input())
D = list(map(int, input().split()))
sortD = sorted(D)
ans = sortD[N//2]-sortD[N//2-1]
print(ans)

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

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

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

Solution (Python):

import sys
def input(): return sys.stdin.readline().rstrip()
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
import heapq
INF = float("inf")
sys.setrecursionlimit(10**7)

dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W
def mi(): return map(int, input().split())
def ii(): return int(input())


N = ii()
Ds = sorted(list(mi())); 

lo = Ds[N//2-1]
hi = Ds[N//2]

print(hi-lo)

Solution (Python):

n = int(input())

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

d_lst.sort()

center_p = len(d_lst) // 2
center_m = center_p - 1

ans = d_lst[center_p] - d_lst[center_m]

print(ans)

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

Solution (Python):

import sys


def solve(N: int, d: "List[int]"):
    import bisect
    d.sort()
    if(N%2 == 1):
        print(0)
    else:
        print(d[int(N/2)] - d[int(N/2)-1])
    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()
print(d[N//2]-d[N//2-1])

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

dlist.sort()
min_ = dlist[N//2 - 1] + 1
max_ = dlist[N//2]

if max_ >= min_:
    print(max_ - min_ + 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):
import sys
from collections import deque  
from collections import defaultdict  
from heapq import heapify, heappush, heappop, heappushpop  
from bisect import bisect_left, bisect_right  



s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))
MOD = int(1e+9) + 7

def main():
    N = i2n()
    D = i2nn()
    D.sort()
    a = D[(N//2)-1]
    b = D[N//2]
    print(b-a)

main()

Solution (Python):
from collections import Counter

N = int(input())
d = Counter(list(map(int, input().split())))
ans = 0
l, r = 0, N

for K in range(10**5+1):
    if l == r:
        ans += 1
    l += d[K]
    r -= d[K]

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

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




print(str(count))

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 = sorted(D)


ind = N//2-1

ans = D[ind+1] - D[ind]

print(ans)

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, D):
    D.sort()
    return D[N//2] - D[N//2-1]


def main():
    N = read_int()
    D = read_int_n()
    print(slv(N, D))


if __name__ == '__main__':
    main()

Solution (Python):
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):
a=int(input())//2
b=list(map(int,input().split()))
b=sorted(b)
left=b[a-1]
right=b[a]
print(right-left)

Solution (Python):
import bisect
from operator import itemgetter
import math
import copy
import collections
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
d = IL()
d.sort()
num = N//2

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

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

ds = sorted(ds)

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

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

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

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

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

Dn = sorted(Dn)
K = Dn[(N-1)//2+1] - Dn[(N-1)//2]
print(K)

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())
dat_d = list(map(int, input().split()))
dat_d.sort()
if n % 2 == 1:
    print(-1)
else:
    
    
    
    res = dat_d[n//2] - dat_d[n//2 - 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.sort()

m = (n-1) // 2
l = d[m]
r = d[m+1]

print(r-l)

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

from itertools import product

from itertools import permutations

from itertools import combinations

from itertools import accumulate
from bisect import bisect_left, bisect_right





def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
INF = float("inf")



N = i_inpl()
d = l_inpl()
d.sort()


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

if ans <= 0:
    print(0)
else:
    print(ans)

Solution (Python):
N = int(input())
d_list = list(map(int, input().strip().split()))
d_list.sort()
l = len(d_list) // 2
d1 = d_list[:l]
d2 = d_list[l:]

print(d2[0] - d1[-1])

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

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

d.sort()

div = n//2

ans = d[div]-d[div-1]

print(ans)

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

d.sort()

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

Solution (Python):
from bisect import bisect_right
n = int(input())
d = list(map(int,input().split()))
d = sorted(d)
cnt = 0
for i in range(max(d)):
    if bisect_right(d,i)==n//2:
        cnt += 1
print(cnt)

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

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


half = n//2
left = arr[half-1]
right = arr[half]

print(int(right-left))

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007
dire4 = [(1,0), (0,1), (-1,0), (0,-1)]
dire8 = [(1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)]

N = I()
d = LI()
d = sorted(d)

left = d[len(d)//2 - 1]
right = d[len(d)//2]

print(right - left)

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

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

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