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
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

INF = float('inf')
NIL = - 1

""" Input
S = input().rstrip()
N, A, B = map(int, input().split())
A = np.array(input().split(), dtype=np.float64)
D = [int(input()) for _ in range(N)]
AB = [[int(x) for x in input().split()] for _ in range(N)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]
"""
N = int(input())
D = list(map(int, input().split()))
D = sorted(D)

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

print(counter)

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

Solution (Python):
def main():
    N = int(input())
    D = [int(a) for a in input().split()]
    D.sort()
    l = D[N//2-1]
    r = D[N//2]
    print(r-l)
if __name__ == "__main__":
    main()

Solution (Python):

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

d.sort()
h = n // 2 - 1

a = d[h]
b = d[h + 1]

print(b - a)

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    s = S()
    b = list(set(s))
    a = len(list(set(s)))
    if a == 2 and s.count(b[0]) == s.count(b[1]) == 2:
        print("Yes")
    else:
        print("No")
    return


def B():
    n = II()
    p = LI()
    ans = 0
    for i in range(1,n-1):
        if (p[i - 1] < p[i] and p[i] < p[i + 1]) or (p[i + 1] < p[i] and p[i] < p[i - 1]):
            ans += 1
    print(ans)
    return


def C():
    n = II()
    d = LI()
    d.sort()
    ans = 0
    for i in range(10**5+1):
        if n // 2 == bisect_left(d, i):
            ans += 1
    print(ans)
    return


def combination_mod(n, k, mod):
    
    

    from math import factorial
    if n < 0 or k < 0 or n < k: return 0
    if n == 0 or k == 0: return 1
    a = factorial(n) % mod
    b = factorial(k) % mod
    c = factorial(n - k) % mod
    return (a * power_func(b, mod - 2, mod) * power_func(c, mod - 2, mod)) % mod
    
def power_func(a, b, mod):
    
    

    if b == 0: return 1
    if b % 2 == 0:
        d = power_func(a, b // 2, mod)
        return d * d % mod
    if b % 2 == 1:
        return (a * power_func(a, b - 1, mod)) % mod


def D():
    n, k = LI()
    ans = 0
    for i in range(1,k+1):
        a = combination_mod(n - k + 1, i, mod)
        b = combination_mod(k - 1, i - 1, mod)
        print((a*b)%mod)
    return


def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == '__main__':
    C()

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
d = LIST()

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())
l = list(map(int,input().split()))
l.sort()
a = n//2

ans = l[a]-l[a-1]

print(ans)

Solution (Python):

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

ans = d[num]-d[num-1]

print(ans)

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

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

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

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

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

nums.sort()

left = n // 2 - 1
right = n // 2
ans = nums[right] - nums[left]
print(ans)

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

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

d.sort()

h1 = d[n//2]
h2 = d[n//2 - 1]

ans = [i for i in range(h2,h1)]

print(len(ans))

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

ld = sorted(ld)

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

print(ans)

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 6)

def main():
    N = int(input())
    D = list(map(int, sys.stdin.readline().rstrip().split()))
    D.sort()
    print(max(0, D[N//2]-D[N//2-1]))


if __name__ == '__main__':
    main()

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

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

print(ans)

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

Solution (Python):

import io
import fractions

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

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

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

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

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

Solution (Python):
import sys

n, *a = map(int, sys.stdin.read().split())
a.sort()

def main():
    m = n // 2
    l, r = a[m-1], a[m]
    print(r - l)
    
if __name__ ==  '__main__':
    main()

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


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

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
import statistics
d.sort()
a = statistics.median_low(d)
c = statistics.median_high(d)

if a == c:
    print(0)
else:
    print((c-a))

Solution (Python):










mod = 10**9 + 7

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

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

same = N / 2









table = {}
for di in d:
    table[di] = 1 if table.get(di) is None else table.get(di) + 1
table = sorted(table.items())

total = 0
start = 0
end = 0
for difficulty, num in table:
    total += num

    if start == 0 and total == same:
        start = difficulty
    elif start != 0:
        end = difficulty
        break



answer = end - start
print(answer)

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

abc = d_inputs[0:n//2]
arc = d_inputs[n//2:n]

print(len([i for i in range(abc[-1]+1,arc[0]+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):



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

n,*d=map(int,open(0).read().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()))

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

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

if n%2 ==0:
  n = int(n/2)
else:
  exit()
  
sortedList = sorted(d)

ans = sortedList[n] - sortedList[n-1]
print(ans)

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

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

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

d_beg, d_reg = d[N // 2 - 1], d[N // 2]
print(len(list(range(d_beg, d_reg))))

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

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

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

count = 0
for i in range(1, max(li)+1):
    index = bisect.bisect_left(li, i)
    
    if index == n//2:
        
        count += 1
print(count)

Solution (Python):
N=int(input())
d=list(map(int, input().split()))
d.sort()
left=d[N//2 -1]
right=d[N//2]
cnt=0
for i in range(left+1, right+1): 
    cnt+=1

print(cnt)

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

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

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

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

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

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

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

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

ABC, ARC = d[:len(d)//2], d[len(d)//2:]


print(ARC[0] - ABC[-1])

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

Solution (Python):
from bisect import bisect_left
n = int(input())
d = sorted([int(x) for x in input().split()])
res = 0
for x in range(d[0], d[-1]+1):
  y = bisect_left(d, x) 
  if 2 * y == n:
    res += 1
print(res)

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):
import math
n=int(input())
d=list(map(int,input().split()))
d.sort()
r=len(d)//2
l=r-1
R=d[r]
L=d[l]
print(R-L)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	n = II()
	d = LI()
	d.sort()
	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()
print(d[n//2]-d[n//2-1])

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

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

Solution (Python):
def mapint_inp():
    return map(int, input().split())

def intinp():
    return int(input())

N = intinp()
d = list(mapint_inp())

sorted_d = sorted(d)

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

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

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

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

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

    n=int(input())
    D=[int(_) for _ in input().split()]
    D.sort()
    print(D[n//2]-D[n//2-1])

if __name__=='__main__':
    main()

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

    n=int(input())
    D=[int(_) for _ in input().split()]
    D.sort()
    print(D[n//2]-D[n//2-1])

if __name__=='__main__':
    main()

Solution (Python):
def myAnswer(N:int, D:list) -> int:
   index = N//2
   D.sort()
   if( D[index - 1] == D[index]): return 0
   return D[index] - D[index - 1]

def modelAnswer():
   tmp=1
def main():
   N = int(input())
   D = list(map(int,input().split()))
   print(myAnswer(N,D))

if __name__ == '__main__':
   main()

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

D = sorted(d)
n = N//2

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

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

n1, n2 = N // 2 - 1, N // 2
D = sorted(D)
print(D[n2] - D[n1])

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

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

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

diff = sorted(diff)
l = diff[int(n/2)-1]
r = diff[int(n/2)]
print(r-l)

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

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

m = N // 2

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

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

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

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

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

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

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

Solution (Python):
import sys
input = sys.stdin.readline
import math
import collections
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

n=I()
ds=LI()
s=sorted(ds)
ans=s[n//2]-s[n//2-1]
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
import math
import collections
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

n=I()
ds=LI()
s=sorted(ds)
ans=s[n//2]-s[n//2-1]
print(ans)

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

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

Solution (Python):
a = int(input())
l = list(map(int, input().split()))
length = len(l)
l = sorted(l)
 
if length%2==1:
	print(0)
else:
	print(l[a//2]-l[a//2-1])

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

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

d.sort()

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

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

D.sort()

A = D[:int(N/2)]
B = D[int(N/2):]

if A[-1] == B[0]:
    print(0)
else:
    print(B[0] - A[-1])

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

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

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()
a = d[N//2-1]
b = d[N//2]
if a==b:
  print(0)
else:
  print(b-a)

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

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

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


if __name__ == '__main__':
    q3()

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

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

Solution (Python):
n = int(input())
ns = list(map(int, input().split()))
sort_ns = sorted(ns)
a = sort_ns[n//2-1]
b = sort_ns[n//2]
print(len([i for i in range(a+1, b+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())
problems = list(map(int, input().split()))
problems = sorted(problems)

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

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

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

sd = sorted(d)





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

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

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

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

low = d[n//2-1]
high = d[n//2]

if low == high:
    print(0)
else:
    print(high-low)

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

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

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

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

Solution (Python):
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect




from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7

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

Solution (Python):
N = int(input())
D = [int(_) for _ in input().split()]
D.sort()
L = D[N//2-1]
R = D[N//2]
ans = R - L
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):
N=int(input())
D=list(map(int,input().split()))
D=sorted(D)
print(D[N//2]-D[N//2-1])

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

n = INT()
d = LIST()
d.sort()
mid = n // 2
print(d[mid] - d[mid - 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 = [int(i) for i in input().split()]

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

Solution (Python):
def main():
    _ = int(input())
    a = list(map(int,input().split()))
    a.sort()
    print(a[len(a)//2] - a[len(a)//2-1])

if __name__ == '__main__':
    main()

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

Solution (Python):
from collections import deque
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n=II()
    aa=LI()
    aa.sort()
    print(aa[n//2]-aa[n//2-1])

main()

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):
a = int(input())
l = list(map(int, input().split()))
length = len(l)
l = sorted(l)

if length%2==1:
	print(0)
else:
	print(l[a//2]-l[a//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, *d = map(int, open(0).read().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 = sorted(list(map(int, input().split())))
res = d[n // 2] - d[n // 2 - 1]
print(res)

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

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

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

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
from decimal import Decimal
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = sorted(inpl())
print(a[n//2] - a[n//2-1])

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

a = sorted(a)
print(a[n // 2] - a[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):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
D = sorted(iil())

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

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

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

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

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

def main():
    n = int(input())
    d = input_nums()
    d.sort()
    m = len(d)//2
    abc_val = d[m-1]+1
    arc_val = d[m]
    if arc_val - abc_val >= 0:
        print(arc_val - abc_val + 1)
    else:
        print(0)

if __name__ == '__main__':
    main()

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

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

d.sort()

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

print(check)

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():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate, groupby
    
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    

    
    

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

if __name__ == '__main__':
    main()

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

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

Solution (Python):
n = int(input())
import heapq
big_list = list(map(int,input().split()))
small_list = []
heapq.heapify(big_list)
heapq.heapify(small_list)
while len(big_list) > n//2:
  heapq.heappush(small_list,heapq.heappop(big_list)*(-1))

b = heapq.heappop(big_list)
s = heapq.heappop(small_list)
if b == -s:
  print(0)
elif b + s > 0:
  print(b+s)

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

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

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

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

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

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

Solution (Python):
from collections import defaultdict, deque
import sys
import heapq
import bisect
import math
import itertools
import string
import queue
import copy
import time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())
 
def inp_list(): return list(map(int, sys.stdin.readline().split()))

N = inp()
dd = inp_list()

dd_sorted = sorted(dd)

border_l = dd_sorted[N // 2 - 1]
border_r = dd_sorted[N // 2]
if border_l == border_r:
    print(0)
else:
    print(border_r - border_l)