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
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, *d = map(int, read().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()
mid = n//2
print(d[mid]-d[mid-1])

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

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

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

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

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


left = d[tar]
right = d[tar + 1]

diff = right - left
if (diff == 0):
    ans = 0
else:
    ans = diff

print(ans)

Solution (Python):

import sys
input = sys.stdin.readline
N = int(input())
d = list(map(int, input().split()))
d.sort()
half_r =len(d)//2
half_l =len(d)//2 -1
ans =d[half_r] -d[half_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.sort()
n2=n//2
num1=d[n2-1]
num2=d[n2]
print(num2-num1)

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


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

Solution (Python):
import itertools
import numpy as np

N = int(input())
points = np.array(list(map(int, input().split())))
ans = 0
s_points = sorted(points)

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

print(ans)

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

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

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

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

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

print(e[n//2]-e[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):

import sys


def solve(N: int, d: "List[int]"):
    half = int(len(d) / 2)
    d = sorted(d)
    bef = list(d[:half])
    aft = list(d[half:])
    ans = aft[0] - bef[len(bef) - 1]
    print(ans)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  
    d = [int(next(tokens)) for _ in range(N)]  
    solve(N, d)


if __name__ == "__main__":
    main()

Solution (Python):






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





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

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

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

d.sort()

cnt = 0

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

print(cnt)

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

Solution (Python):
def resolve():
    N = int(input())
    d = list(map(int, input().split()))
    
    d.sort()
    if d[int(N/2-1)] < d[int(N/2)]:
        ans = len(range(d[int(N/2-1)], d[int(N/2)]))
    else:
        ans = 0
    print(ans)
resolve()

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

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

d.sort()

cnt = 0

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

print(cnt)

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

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

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

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

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

D.sort()

smallest_arc = D[N//2]
largest_abc = D[N//2 - 1]

print(smallest_arc - largest_abc)

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

D.sort()

smallest_arc = D[N//2]
largest_abc = D[N//2 - 1]

print(smallest_arc - largest_abc if smallest_arc != largest_abc else 0)

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

D = sorted(D)
left = D[N//2-1]
right = D[N//2]

print(right-left)

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


print(sa)

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

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

Solution (Python):
'''
参考
https://drken1215.hatenablog.com/entry/2019/06/29/224100
dをソートし、d[N//2]-d[N//2-1]が解
'''
n = int(input())
d = list(map(int, input().split()))
d.sort()

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

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

arc_list = list()
abc_list = list()

harf_num = int(n/2)

d.sort()
abc_list = d[:harf_num]
arc_list = d[harf_num:]

abc_max = max(abc_list)
arc_min = min(arc_list)

print(arc_min - abc_max)

Solution (Python):

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

Solution (Python):
n,*a=map(int,open(0).read().split());a.sort()
print(a[n//2]-a[n//2-1])

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

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
d.sort()
l=n//2-1
half=(d[l]+d[l+1])//2
count=0
sum=0
if d[l]==d[l+1]:
  print(0)
  exit()
sum+=d[l+1]-d[l]
print(sum)

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

d = [0]*N
tmp = input().split()
for n in range(N):
    d[n]= int(tmp[n])

d.sort()

dm = d[N//2-1]
dM = d[N//2]

if dm == dM:
    print(0)
else:
    print(dM-dm)

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
d.sort()
l=n//2-1
half=(d[l]+d[l+1])//2
count=0
sum=0

if d[l]==d[l+1]:
  print(0)
  exit()

if d[l+1]>half:
  sum+=d[l+1]-half

if d[l]!=half:
  sum+=half-d[l]
  
print(sum)

Solution (Python):
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from math import ceil, floor, sqrt
from copy import deepcopy

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

if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
     
if N % 2 == 1:
    print(0)
    exit()
    
d.sort()




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

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

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

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

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

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

middle = n // 2
a = sort_d[:middle]
b = sort_d[middle:]
print(sort_d[middle]-sort_d[middle-1])

Solution (Python):
n = int(input())
d = sorted(list(map(int, input().split())))
h = int(len(d) / 2)
ans = 0

if d[h-1] != d[h]:
    ans = d[h] - d[h-1]

print(ans)

Solution (Python):

def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n): return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)


from collections import Counter,deque,defaultdict





n=n0()
d=n1()

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

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

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
sorted_d = sorted(d)
count = 0
for i in range(sorted_d[len(sorted_d)//2-1], sorted_d[len(sorted_d)//2]):
    count += 1
print(count)

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

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

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

if len(d)%2==1:
    print(0)
else:
    print(d[-len(d)//2]-d[-len(d)//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):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from bisect import bisect_left 
def main():
    n = int(readline())
    d = [int(i) for i in readline().split()]
    INF = int(1e5)+1
    d.sort()
    ins_pos = n//2    
    cnt = 0 
    for k in range(1, INF):
        idx = bisect_left(d, k)
        if idx == ins_pos:
            cnt += 1
    print(cnt)
if __name__ == '__main__':
    main()

Solution (Python):
import bisect
N=int(input())
d=list(map(int,input().split()))
d=sorted(d)
num=len(d)
ans=0
val=max(d)
for i in range(val+1):
  tmp=bisect.bisect_left(d,i)
  if tmp==num-tmp:
    ans+=1
print(ans)

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

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


def mi():
    return map(int, input().split())


def ii():
    return int(input())


N = ii()
d = li()

d.sort()

mean = d[len(d) // 2]

res = 0
if d[len(d) // 2 - 1] < mean:
    res = mean - d[len(d) // 2 - 1]
print(res)

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

d.sort()

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

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

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

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

Solution (Python):
import sys
from bisect import bisect_left, bisect_right

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

N = I()
d= LI()

d.sort()

ans = 0
for i in range(d[-1]):
    right = bisect_right(d, i)
    if right == N / 2:
        ans += 1

print(ans)

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

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

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

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

d = sorted(d)

a = n//2

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

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

Solution (Python):
import statistics

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

median_low = statistics.median_low(d)
median_high = statistics.median_high(d)

print(median_high-median_low)

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

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

List.sort()

a = List[int(N/2-1)]
b = List[N//2]

print(int(b-a))

Solution (Python):


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

d.sort()

center = len(d)//2-1

if d[center] == d[center+1]:
    print(0)
    exit()
else:
    d[center]

    print(d[center+1]-d[center])
    exit()

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

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

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

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

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count





N = I()
d = IL()

d.sort()

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

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


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


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


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


def main():
    N = readint()
    d = sorted(list(readnums()))
    print(d[N // 2] - d[N // 2 - 1])


if __name__ == "__main__":
    main()

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

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

d.sort()

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

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

Solution (Python):
n = int(input())
d_list = list(map(int,input().split()))
d_list.sort()
n_half = n//2
left = d_list[n_half-1]+1
right = d_list[n_half]
dum = right-left
if dum < 0:
    print(0)
else:
    print(dum+1)

Solution (Python):
N = int(input())
aList = list(map(int, input().split()))
BacketSize = [0 for n in range(100010)]
for n in range(N):
    index = aList[n]
    BacketSize[index] += 1
    
for n in range(100010):
    BacketSize[n] += BacketSize[n-1]

i = 0
count = 0
while(BacketSize[i] <= (N / 2)):
    if(BacketSize[i] == (N/2)):
        count += 1
    i += 1
print (count)

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

ans = 0
d.sort()

abc = d[0:n//2]
arc = d[n//2:n]
if len(abc) == len(arc):
	ans = d[n//2] - d[n//2-1] 
print(ans)

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

d = sorted(d)
mid_low = d[n//2-1]
mid_high = d[n//2]

print(mid_high - mid_low)

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

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

if len(d) % 2 == 1:
    print(0)
else:
    d = sorted(d)
    left = d[len(d) // 2 - 1]
    right = d[len(d) // 2]
    print(max(0, right - left))

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

d.sort()
x = int(N / 2)

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

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

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

Solution (Python):

def inp():
    return(int(input()))



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



def instr():
    s = input()
    return(list(s[:len(s)]))



def invr():
    return(map(int, input().split()))


n = inp()

arr = inlist()
arr = sorted(arr)
n = int(n/2)
kl = int(arr[n-1])
kh = int(arr[n])
print(max(0, kh-kl))

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

Solution (Python):
import math
from collections import deque
from collections import defaultdict

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): 
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): 
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} 
def bitArr(n):
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): 
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq

n = readInt()
d = readInts()

d.sort()

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

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

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

    
resolve()

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

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

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

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

Solution (Python):

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


sort_d = sorted(d)
c = N // 2
print(len(list(range(sort_d[c - 1], sort_d[c]))))

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

dlist.sort()

half = len(dlist)//2

print(dlist[half]-dlist[half-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()
a = d[n // 2 - 1]
b = d[n // 2]
print(b - a)

Solution (Python):
N = int(input())
D = [int(i) for i 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()

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

print(ans)

Solution (Python):
def resolve():
    N = int(input())
    A = list(map(int, input().split()))

    if (N % 2 != 0):
        print(0)
        return

    A.sort()

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

    print(ans)


resolve()

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

Solution (Python):
def main():
    N = int(input())
    q_list = list(map(int, input().split()))
    num = len(q_list)

    q_list.sort()

    ans = q_list[int(num / 2)] - q_list[int(num / 2 - 1)]
    print(ans)


if __name__ == '__main__':
    main()

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

d.sort()

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

Solution (Python):
n=int(input())
d=[0]*n
d[:]=map(int,input().split())
d.sort()


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

Solution (Python):
import bisect

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

ans=0
for i in range(1,d[-1]+1):
    if bisect.bisect_left(d,i)==n-bisect.bisect_left(d,i):
        ans+=1

print(ans)

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

Solution (Python):
n = int(input())
di = list(map(int,input().split()))
di.sort()
center = n//2
left = di[center-1]
right = di[center]
ans = right-left
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())
P = list(map(int, input().split()))
P.sort()

A = P[int(N/2)-1]
B = P[int(N/2)]

print(B-A)

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

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

if c!=d:
	print(d-c)
else:
	print(0)

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

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

Solution (Python):
import sys
import math
import bisect

def solve(A):
    n = len(A)
    A.sort()
    l = (n - 1) // 2
    r = l + 1
    return A[r] - A[l]

def main():
    n = int(input())
    A = list(map(int, input().split()))
    print(solve(A))

if __name__ == "__main__":
    main()

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

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

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

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

print(a - b)

Solution (Python):
import itertools
import math
import fractions
import functools
import copy

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

d.sort()

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

Solution (Python):
import sys

n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = []

nh1 = n//2 - 1
nh2 = nh1 + 1

if a[nh1] == a[nh2]:
    print(0)
    sys.exit()
else:
    for i in range(a[nh1]+1,a[nh2]+1):
        ans.append(i)

print(len(ans))

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

Solution (Python):
import sys
n, *lst = map(int, sys.stdin.read().split())
lst.sort()
l, r = lst[n//2 - 1], lst[n//2]
print(r - l)

Solution (Python):
def divide_the_problems(n, dli):

    dli.sort()

    n = int(n/2)
    ans = dli[n] - dli[n-1]

    return ans

def main():
    n = int(input())
    dli = list(map(int, input().split()))
    print(divide_the_problems(n, dli))

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

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

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

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

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

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

print(abs(arr[int((N/2)-1)]-arr[int(N/2)]))

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

Solution (Python):
N = int(input())
D = [int(j) for j in input().split()]
import bisect
cnt = 0
mi = min(D)
ma = max(D)
D = sorted(D)
for i in range(mi,ma+1):
    if bisect.bisect_left(D,i) == N/2:
        cnt+=1
print(cnt)

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

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

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

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):
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def SS(): return map(str,sys.stdin.readline().rstrip().split())
def II(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()
d = LI()
d.sort()

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

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

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

d = sorted(d)

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

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

Solution (Python):
import math
def py():
    print("Yes")
def pn():
    print("No")
def iin():
    x = int(input())
    return x

neko = 0
nya = 0
nuko = 0

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

neko = int(n/2 - 1)
nuko = neko + 1
if d[neko] != d[nuko]:
    for i in range(d[nuko]-d[neko]):
        nya = nya + 1
    
print(nya)

Solution (Python):
N = int(input().rstrip())
line = input().rstrip()
l = [int(v) for v in line.split()]
l.sort()
uniq_list = sorted(list(set(l)))
result = 0
start_at = 0
for i in range(len(uniq_list)):
    for j in range(start_at, len(l)):
        if uniq_list[i] == l[j]:
            if (N / 2) == j:
                result = uniq_list[i] - uniq_list[i - 1]
            else:
                start_at = j + 1
            
            break

print(result)