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



Sample input:
6
9 1 4 4 6 7


Sample output:
2

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
dific_list = [int(i) for i in input().\
split(" ")]
dific_list.sort()
print(max(0, dific_list[int(n / 2)] \
- dific_list[int(n / 2) - 1]))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

d.sort()

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

print(ans)

Submission status: Accepted

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

#import numpy
#m=int(numpy.median(d)-2)

y=sorted(d)
z=len(d)
w=int(z/2)

m=y[w-1]
n=y[w]
#print(y)
print(n-m)

# ans=0
# flag=0
# for K in range(m,d_max):
#     arc=0
#     abc=0
#     if flag==1:
#         break
#     for i in range(len(d)):
#         if(K > d[i]):
#             abc+=1
#         if(K <= d[i]):
#             arc+=1
#         if(abc > len(d)/2):
#             flag=1
#             break
#         print(arc,abc,ans,j,d[i])
#     if abc==arc:
#         ans+=1
# print(ans)

Submission status: Accepted

Solution code:
n = int(input())
r = list(map(int,input().split()))

r.sort()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input_line=int(input())
ARC = [int(i)for i in input().split()]
ARC.sort()
middle = input_line //2
s = ARC[middle]-ARC[middle-1]

print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
data = list(map(int, input().split()))
for i in range(n):
    data[i] = int(data[i])
data.sort()
print(data[n//2] - data[n//2 - 1])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

def check(a,b,c):
	if((a<b)and(b<c))or((a>b)and(b>c)):
		return 1
	return 0

import sys
n = int(input())
tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))

#print(hoge)
hoge.sort()
n=len(hoge)
#print(hoge)

m=n//2
if(hoge[m-1] == hoge[m]):
	print(0)
	sys.exit()

l=hoge[m]-hoge[m-1]

#sum=0
#for i in range(n-2):
#	sum += check(hoge[i],hoge[i+1],hoge[i+2])

print(l)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A  = input().split()
for i in range(N):
  A[i] = int(A[i])
  
A.sort()
middle = int(N/2)
gap = A[middle] - A[middle - 1]
print(gap)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# ABC132 C Divide the Problems

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
D = [int(x) for x in input().split()]
D.sort()
mid = N//2
ans = D[mid] - D[mid-1]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

abc, arc = sorted(li_q)[:n // 2], sorted(li_q)[n // 2:]

print(arc[0] - abc[-1])

Submission status: Accepted

Solution code:
N = int(input())
ds_ = list(map(int,input().split()))
ds = sorted(ds_)

def solve():
	low = ds[N//2 - 1]
	high = ds[N//2]
	
	return high - low
	
print(solve())

Submission status: Accepted

Solution code:
n = int(input())
arr = list(map(int, input().strip().split()))

sorted_arr = sorted(arr)
mid = n // 2
ans = sorted_arr[mid] - sorted_arr[mid-1]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

def solve():
  sorted_D = sorted(D)
  return sorted_D[N//2] - sorted_D[N//2-1]

print(solve())

Submission status: Accepted

Solution code:
# Check Examples

#python 3.7.1

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

p=sorted(p)

if p[n//2]!=p[(n//2)-1]:
	cnt=p[n//2]-p[(n//2)-1]



print (cnt)

Submission status: Accepted

Solution code:
N=int(input())
D=[int(i) for i in input().split()]
D=sorted(D)
nanko=0
for i in range(D[N-1]+1):
    if(D[int(N/2)-1]<i and D[int(N/2)]>=i):
        nanko+=1
print(nanko)

Submission status: Accepted

Solution code:
print((lambda N,d:((N+1)%2)*(d[N//2]-d[N//2-1]))(int(input()),sorted(list(map(int,input().split())))))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def is_even(num):
    if num % 2 == 0:
        return True
    else:
        return False

def is_odd(num):
    if num % 2 == 1:
        return True
    else:
        return False


n=int(input())


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

d=sorted(d)
LEN=int(len(d)/2)
if is_even(LEN):
    if d[LEN]==d[LEN-1]:
        print(0)

    else:
        print(d[LEN]-d[LEN-1])

elif is_odd(LEN):
    if d[LEN]==d[LEN-1]:
        print(0)

    else:
        print(d[LEN]-d[LEN-1])

Submission status: Accepted

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

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

Submission status: Accepted

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

n1 = N//2
print(d_list[n1] - d_list[n1 - 1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

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

d.sort()

m=n//2

e= d[m] - d[m-1]
print(e)

Submission status: Accepted

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

sd = sorted(d)
leng = len(sd)
lenha = int(leng/2)
if sd[lenha-1] == sd[lenha]:
    ans = 0
else :
    ans = sd[lenha] - sd[lenha-1]

print(ans)

Submission status: Accepted

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

d.sort()
left_boundary = int(N/2-1)
right_boundary = int(N/2)

if d[left_boundary] ==d[right_boundary]:
    print("0")
else:
    print(d[right_boundary] - d[left_boundary])

Submission status: Accepted

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

d = sorted(d)

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

Submission status: Accepted

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

Submission status: Accepted

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

li.sort()

a = int(len(li) / 2)

print(li[a] - li[a - 1])

Submission status: Accepted

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

D.sort()

center = int(N/2)

print(D[center] - D[center-1])

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(100000)

def intinput(): return map(int,sys.stdin.readline().split())

x=int(input())
t=list(intinput())
ans=0
t.sort()
print(t[x//2]-t[x//2-1])

Submission status: Accepted

Solution code:
def main():
    n = int(raw_input())

    diff = map(int,raw_input().split())

    sorted_diff = sorted(diff)

    print(sorted_diff[len(sorted_diff)/2] - sorted_diff[len(sorted_diff)/2 - 1])


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
d_list = list(map(int,input().split()))

mid_index = int(n/2-1)
d_list.sort()
mids = d_list[mid_index:mid_index+2]

print(mids[1]-mids[0])

Submission status: Accepted

Solution code:
lineNum = int(input())
diffData = list(map(int,input().split(" ")))
sortedDiffData = sorted(diffData)
diffDiff = sortedDiffData[len(sortedDiffData)//2] - sortedDiffData[(len(sortedDiffData)//2)-1]
print(diffDiff)

Submission status: Accepted

Solution code:
N=int(input())
d=list(map(int, input().strip().split()))
ans=0

d.sort()

#for i in range(int(d[int(N/2)-1]),int(d[int(N/2)]+1)):

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve(string):
    n, *d = map(int, string.split())
    d = sorted(d)
    return str(d[n//2]-d[n//2-1])


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))

Submission status: Accepted

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

#listをソートして並べ替える
d = sorted(d)
#n//2番目の値とn//2-1の値を引けば求められる
print(d[n // 2] - d[(n // 2) - 1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
d = list(map(int,input().split()))
d.sort()
ans=d[n//2]-d[n//2-1]
print('{}'.format(ans))

Submission status: Accepted

Solution code:
def f(n, arr):
    if n % 2: return 0
    s = sorted(arr)
    return s[n // 2] - s[(n // 2) - 1]





n = int(input())
arr = [ int(i) for i in input().split(' ') ] 
print(f(n, arr))

Submission status: Accepted

Solution code:
N = int(input())
lst = [int(i) for i in input().split()]
lst.sort()
x = int(N/2)
print(lst[x]-lst[x-1])

Submission status: Accepted

Solution code:
#C

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

d.sort()

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

print(b-a)
#print(d)

Submission status: Accepted

Solution code:
n = int(input())
dd = [int(x) for x in input().split()]

dd_sorted = sorted(dd)
print(dd_sorted[n//2] - dd_sorted[n//2 - 1])

Submission status: Accepted

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

d.sort()

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

Submission status: Accepted

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

dBelowMiddle = d[middle - 1]
dAbobeMiddle = d[middle]

print(dAbobeMiddle - dBelowMiddle)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
test_dif = input().split(" ")

n = int(n)
test_dif = [int(n) for n in test_dif]
test_dif2 = sorted(test_dif)
a = test_dif2[int(n/2)-1]
b = test_dif2[int(n/2)]
ans = b - a
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
l = sorted(map(int, input().split()))
j, K = -1, 0

for i in range(N):
    if j != l[i]:
        j = l[i]
        a, b = i, N-i
        
        if a == b:
            K += 1
            
            if i:
                K += l[i]-l[i-1]-1

print(K)

Submission status: Accepted

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

d.sort()
s1 = d[int(N/2) - 1]
s2 = d[int(N/2)]

print(s2-s1)

Submission status: Accepted

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

dlist.sort()

M = int(N/2)

ans = dlist[M] - dlist[M-1]

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
*l, = sorted(map(int,input().split()))
#print(l)
if l[n//2]==l[n//2-1]:
  print(0)
  exit()
print(l[n//2]-l[n//2-1])

Submission status: Accepted

Solution code:
n = int(input())
d = input().split()

for i in range(n):
    d[i] = int(d[i])

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

Submission status: Accepted

Solution code:
N = int(input())
num = [int(i) for i in input().split()]

num.sort()

ans = num[len(num) // 2] - num[len(num) // 2 - 1]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

d.sort()
harf_pre = d[n // 2 - 1]
harf_post = d[n // 2]

print(harf_post - harf_pre)

Submission status: Accepted

Solution code:
n = int(input())
ls = []
get_values = input()
ls = get_values.split() 
for i in range(len(ls)):
    ls[i] = int(ls[i]) 
ls.sort() 
print(ls[n//2]-ls[n//2-1])

Submission status: Accepted

Solution code:
_, d = int(input()), sorted([int(i) for i in input().split()])
print(d[len(d)//2] - d[len(d)//2-1])

Submission status: Accepted

Solution code:
N = int(input())
d = [int(i) for i in input().split()]
d.sort()
hf = d[len(d)//2-1]
hb = d[len(d)//2]
print(hb - hf)

Submission status: Accepted

Solution code:
def main():
    n = input()
    d_list = list(map(int, input().split()))
    d_list.sort()
    arc = d_list[int(len(d_list) / 2)]
    abc = d_list[int(len(d_list) / 2) - 1]
    print(arc - abc)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()

n = ni()
a = na()
a.sort()
print(a[n//2] - a[n//2 - 1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())

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

b.sort()

c = len(b) // 2

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

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input()
d = [int(i) for i in input().split(' ')]
d = sorted(d)
N = len(d)
l, h = d[:N // 2], d[N // 2:]
ml = max(l)
mh = min(h)
print(mh - ml)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = int(input())
list = [int(n) for n in input().split()]

s_l = sorted(list)
print(s_l[s//2] - s_l[s//2 - 1])

Submission status: Accepted

Solution code:
s = int(input())
list = [int(n) for n in input().split()]

print(sorted(list)[s//2] - sorted(list)[s//2 - 1])

Submission status: Accepted

Solution code:
s = int(input())
list = [int(n) for n in input().split()]

temp1 = []
temp2 = []
sorted_list = sorted(list)

for i in range(s//2):
    temp1.append(sorted_list[i])

for i in range(s//2, s):
    temp2.append(sorted_list[i])

if temp1[-1] >= temp2[0]:
    print(0)
else:
    print(temp2[0] - temp1[-1])

Submission status: Accepted

Solution code:
import statistics

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

median = statistics.median(d)
print(statistics.median_high(d) - statistics.median_low(d))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
data = [int(i) for i in input().split(" ")]
data.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
p = [int(i) for i in input().split(" ")]
p = sorted(p)
print(p[n//2]  - p[n//2 - 1] )

Submission status: Accepted

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

Submission status: Accepted

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

d.sort()
a = d[N // 2 - 1]
b = d[N // 2]

print(b - a)

Submission status: Accepted

Solution code:
n=int(input())
d=list(map(int,input().split()))
d.sort()
count=0
R=d[n//2-1]
L=d[n//2]
if L==R:
    count=0
else:
    count=L-R
print(count)
#print(d)
#print(str(R)+" "+str(L))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import numpy as np

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

p.sort()

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

Submission status: Accepted

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

d.sort()

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
A = sorted(list(map(int,input().split())))

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

Submission status: Accepted

Solution code:
def solve():
  n = int(input())
  p = list(int(i) for i in input().split())
  p.sort()
  
  ans = p[n//2]-p[-1 + n//2]
  print(ans)
solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    n=int(input())
    d=list(map(int,input().split()))
    ss=sorted(d)
    ans=0
    if n%2==0:
        m=n//2-1
        if ss[m]==ss[m+1]:
            ans=0
        else:
            ans=ss[m+1]-ss[m]
    else:
        ans=0
    print(ans)
    
resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, d_list = int(input()), list(map(int, input().split()))
print(max(sorted(d_list)[N // 2 - 1: N // 2 + 1]) - min(sorted(d_list)[N // 2 - 1: N // 2 + 1]))

Submission status: Accepted

Solution code:
N = int(input())

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

D2 = sorted(D)
A = D2[N//2-1]
B = D2[N//2]
print(abs(A-B))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
NN=N//2
L=list(map(int,input().split()))
L.sort()
L+=[L[-1]+111]
j=-1
K=0
ans=0
for K in range(1,L[-2]+1):
  while L[j+1]<=K:
    j+=1
    
  if j+1==NN:
    ans+=1
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect

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

d.sort()
ans = 0

for k in range(1, max(d)+1):
  i = bisect.bisect_left(d,k)
  if i == n - i:
    ans += 1
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

d.sort()
left = d[int(N/2-1)]
right = d[int(N/2)]

dif = right - left

print(dif)

Submission status: Accepted

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

d_list = sorted(d_list)
#print(d_list)                                                                           
#if N%2 == 0:                                                                            
d_1 = d_list[len(d_list)//2-1]
d_2 = d_list[len(d_list)//2]
print(d_2-d_1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
DDD = list(map(int, input().split()))

DDD.sort()

mannaka = N//2
print(DDD[N//2] - DDD[(N//2)-1])

Submission status: Accepted

Solution code:
n = int(input())
d = list(map(int,input().split()))
d.sort()
while len(d) > 0:
        x = d.pop()
        y = d.pop(0)
print(x - y)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#abc132c

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

Submission status: Accepted

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

count = 0

if n % 2 == 0:
    d.sort()
    tmp = n  // 2

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

    else:
        print(d[tmp]-d[tmp-1])

else:
    print(0)

Submission status: Accepted

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

d.sort()

m = n // 2

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())//2-1
d=[int(i) for i in input().split()]
d.sort()
abc,arc=d[n],d[n+1]
print(arc-abc if arc!=abc else 0)

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
d = list(map(int, input().split()))
d = np.sort(d)
print(max(d[n//2] - d[n//2-1], 0))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
d=[int(a) for a in input().split()]

d.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

d = sorted(D)
mi_l, mi_h = d[N // 2 - 1], d[N // 2]
#print(mi_h, mi_l)
print(max(0, mi_h - mi_l))

Submission status: Accepted

Solution code:
n = input()
l = sorted([int(x) for x in raw_input().split()])
print l[n/2] - l[n/2-1]

Submission status: Accepted

Solution code:
n = int(input())
arr = list(map(int, input().split()))

arr.sort()
high = arr[n // 2]
low = arr[n // 2 - 1]

print(high - low)

Submission status: Accepted

Solution code:
n = int(input())
ds = [int(c) for c in input().split()]
ds.sort()
m = n // 2
print(ds[m] - ds[m-1])

Submission status: Accepted

Solution code:
n=int(input())
dlist=[int(d) for d in input().split()]

dlist.sort()

left=dlist[n//2-1]
right=dlist[n//2]
print(max(right-left,0))

Submission status: Accepted

Solution code:
n = input()
N = input()
N = N.split(" ")
Ni = []
n = int(n)
for i in N:
    Ni.append(int(i))
l = sorted(Ni)
print(l[(n//2)] - l[(n//2)-1])

Submission status: Accepted

Solution code:
import numpy as np

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

arr_d = np.array(d)

d_sorted = np.sort(arr_d)

n1 = int(N / 2)
n2 = int(N / 2 - 1)

ans = d_sorted[n1] - d_sorted[n2]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=input().split()
for i in range(0,n):
  a[i]=int(a[i])
a.sort()
print(a[n//2]-a[n//2-1])

Submission status: Accepted

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

d.sort()

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

print(num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
*d, = map(int,input().split())

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
N = int(int(input())/2)
d = list(map(int, input().split()))
d.sort()
print(d[N]-d[N-1])

Submission status: Accepted

Solution code:
num_input = int(input())
input_arr = [int(x) for x in input().split()]

max_input = max(input_arr)
count = 0
second_arr =[]
first_arr = []
sorted_arr = sorted(input_arr)
ans = sorted_arr[int(num_input/2)] - sorted_arr[int(num_input/2)-1]
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
questions = sorted(list(map(int, input().split())))

half = int(n/2)
bottom = questions[half-1]
top = questions[half]

print(top - bottom)

Submission status: Accepted

Solution code:
a = int(input())
ar = list(map(int,input().split(" ")))
ar.sort()
lr = ar[0:a//2]
hr = ar[a//2:a]
print(min(hr)-max(lr))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=input()
D=map(int,raw_input().split())
D.sort()
m0=D[len(D)/2-1]
m1=D[len(D)/2]
print(m1-m0)

Submission status: Accepted

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

d.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import bisect
input = sys.stdin.readline

N = int(input())
L = [int(v) for v in input().split()]
L.sort()

ans = 0
n = N // 2
for v in range(2, L[-1] + 1):
    if n == bisect.bisect_left(L, v):
        ans += 1
        
print(ans)

Submission status: Accepted

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

d_sorted = sorted(d)
center = n//2-1
print(d_sorted[center+1] - d_sorted[center])

Submission status: Accepted

Solution code:
a = int(input())
b = [int(i) for i in input().split()]
b.sort()
if b[a // 2 - 1] == b[a // 2]:
    print(0)
else:
    print(b[a // 2] - b[a // 2 - 1])