Problem:
 Score : 300 points    Problem Statement Takahashi made N problems for competitive programming.
The problems are numbered 1 to N , and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).  He is dividing the problems into two categories by choosing an integer K , as follows:   A problem with difficulty K or higher will be for ARCs .  A problem with difficulty lower than K will be for ABCs .   How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?      Problem Statement  2 \leq N \leq 10^5  N is an even number.  1 \leq d_i \leq 10^5  All values in input are integers.         Input Input is given from Standard Input in the following format:  N  d_1  d_2  ...  d_N       Output Print the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.        Sample Input 1 6
9 1 4 4 6 7      Sample Output 1 2  If we choose K=5 or 6 , Problem 1 , 5 , and 6 will be for ARCs, Problem 2 , 3 , and 4 will be for ABCs, and the objective is achieved.
Thus, the answer is 2 .       Sample Input 2 8
9 1 14 5 5 4 4 14      Sample Output 2 0  There may be no choice of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.       Sample Input 3 14
99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1      Sample Output 3 42685

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

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

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

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

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

Solution (Python):


import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))




def resolve():
    n,=pin()
    D=lispin()
    D.sort()
    
    print(D[(n//2)]-D[n//2-1])            
    

resolve()

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

sd = sorted(d)
sd.insert(0,0)

m=n//2

if sd[m] != sd[m+1]:
    print(sd[m+1]-sd[m])
else:
    print(0)

Solution (Python):


from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

yes = "Yes"
no = "No"

def main():
    n = ii()
    d = li()
    d = sorted(d)
    print(d[n//2]-d[n//2-1])


main()

Solution (Python):
n = int(input())
a = sorted(list(map(int, input().split())))
q = n//2

print(0) if a[q-1] == a[q] else print(a[q] - a[q-1])

Solution (Python):
n = int(input())
a = sorted(list(map(int, input().split())))
q = n // 2

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

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

a.sort()
q = n // 2

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

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

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

d = sorted(D)
a = d[N // 2 - 1]
b = d[N // 2]
ans = 0
for i in range(a, b):
    ans += 1
print(ans)

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

Solution (Python):
import sys

readline = sys.stdin.readline

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

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

if __name__ == "__main__":
    main()

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

upper = d_ls[n // 2]
lower = d_ls[n // 2 - 1]
print(upper - lower)

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

p = sorted(p)

c_left = p[int(n/2)-1]
c_right = p[int(n/2)]

print(c_right-c_left)

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


solve()

Solution (Python):
import sys

input = sys.stdin.readline

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

if __name__ == '__main__':
    main()

Solution (Python):
import sys
import collections as c

input = sys.stdin.readline

def main():
    ans = 0
    n = int(input())
    d = list(map(int, input().split()))
    d.sort()
    g = d[n//2]
    items_count = c.Counter(d)
    gc = items_count[g]
    if gc == 1 or d[n//2-1] != g:
        ans += g - d[n//2-1]
    print(ans)

if __name__ == '__main__':
    main()

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

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

if left==right:
    print(0)
else:
    print(right - left)

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):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce


import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


n = I()
D = LI()
D.sort()
a = D[int(n/2)-1]
b = D[int(n/2)]
print(b-a)

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

Solution (Python):
n  = int(input())
li = list(map(int,input().split()))
c  = len(li)//2

li.sort()

diff = li[c]-li[c-1]

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

Solution (Python):


n = int(input())
d = list(map(int, input().split()))
n = len(d) // 2
x = sorted(d)
if x[n-1] != x[n]:
    print(x[n] - x[n - 1])
else:
    print(0)

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):
def main():
    N = int(input())
    d = [int(x) for x in input().split()]
    d.sort()
    median = int(N / 2)
    k = d[median] - d[median - 1]
    print(k)


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

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

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

a = sorted(a)

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

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

abc_right = d_list[len(d_list) // 2 - 1]
agc_left = d_list[len(d_list) // 2]

print(agc_left - abc_right)

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

d = sorted(d)
x = d[n // 2] - d[n // 2 - 1]
print(max(0, x))

Solution (Python):
import sys
import math
from collections import Counter
import itertools
import fractions



def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, 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 SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'


p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")


 
N=II()
d=LI()

d.sort()

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

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

n = N//2

d = sorted(D)

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

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

Solution (Python):
N=int(input())
L=list(map(int,input().split()))
l=sorted(L)
if N%2==0:
  n=int(N/2)
  a=l[n-1]
  b=l[n]
  if a==b:
    print('0')
  else:
    print(b-a)
    
else:
  print('0')

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

Solution (Python):

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

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

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

d.sort()

middle = int(len(d)/2)

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

Solution (Python):
k = int(input())
seqS=input().split(" ")
num=[]
for q in seqS:
    num.append(int(q))
contador,abc,arc=0,0,0
num.sort() 

print(num[int(len(num)/2)]- num[int(len(num)/2)-1])

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

Solution (Python):
def main():
    n = int(input())
    dif = [int(x) for x in input().split()]
    dif.sort()
    meio = n//2
    dif1 = dif[:meio]
    dif2 = dif[meio:]
    print(dif2[0] - dif1[-1])

main()

Solution (Python):
n=int(input())
v=[int(i) for i in input().split()]
v=sorted(v)
j=int((n/2))
k=int((n/2)-1)
if v[j]!=v[k]:
    print(v[j]-v[k])
else:
    print("0")

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

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

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

Solution (Python):

N = int(input())
P = list(map(int, input().split()))
P.sort()
print(P[N//2] - P[N//2 - 1] if P[N//2] != P[N//2 - 1] and N % 2 ==0 else 0)

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

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

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

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

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

num = N // 2
arc = 0
for _ in range(N):
    arc_first = D.pop()
    arc += 1
    if arc == num:
        break
abc_last = D.pop()

if abc_last == arc_first:
    
    ans = 0
else:
    ans = arc_first - abc_last

print(ans)

Solution (Python):
def resolve():
    n = int(input())
    d = sorted([int(i) for i in input().split()])
    half = int(len(d) / 2)
    abc = d[:half]
    arc = d[half:]

    if abc[-1] == arc[0]:
        print(0)
    else:
        print(arc[0] - abc[-1])

resolve()

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

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

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

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
input = sys.stdin.readline









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

D.sort()

abc_max = D[N//2-1]
arc_min = D[N//2]

print(max(0,arc_min - abc_max))

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

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

print(right-left)

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

import sys
read = sys.stdin.buffer.read 
readline = sys.stdin.buffer.readline 
readlines = sys.stdin.buffer.readlines 
sys.setrecursionlimit(10**7) 

"""

n = readline().rstrip() 
lis = readline().rstrip().split() 


n = int(readline().rstrip()) 
a, b, c = map(int,readline().rstrip().split()) 
A = list(map(int,readline().rstrip().split()))  
lis = [readline().rstrip().split() for _ in range(n)] 

"""

n=int(readline().rstrip())
d=list(map(int,readline().rstrip().split()))

d_inv=sorted(d)

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

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

s = d[len(d)//2-1]
e = d[len(d)//2]
print(len([i for i in range(s+1,e+1)]))

Solution (Python):
from collections import deque


def main():
    N = int(input())
    d = list(map(int, input().split(' ')))
    d.sort()
    d = deque(d)
    threshold_min, threshold_max = 0, 0
    for _ in range(N // 2):
        threshold_min = d.popleft()
        threshold_max = d.pop()
    print(threshold_max - threshold_min)


if __name__ == '__main__':
    main()

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

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

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

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

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

s.sort()
m = s[int(n/2)-1]
M = s[int(n/2)]
print(M-m)

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

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

num = n//2

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

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

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


main()

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

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

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

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

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

print (tmp)

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

Solution (Python):

N, *A = map(int, open(0).read().split())
A.sort()

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

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

L, R = D[N // 2 - 1], D[N // 2]
print(R - L)

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

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

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

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

m = n//2

x,y = d[m-1:m+1]
ans = y - x
print(ans)

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

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

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

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

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

ds = sorted(d)

sub = ds[n//2] - ds[n//2-1]

print(sub)

Solution (Python):
import math

n=int(input())
li = list(map(int,input().split()))
li.sort()
print(li[math.floor(n/2)]-li[math.floor(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=[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=sorted(list(map(int,input().split())))
c=N//2
print(d[c]-d[c-1])

Solution (Python):
import statistics
import math
n = int(input()) 
s = list(map(int,input().split()))
s.sort()

med_ind = len(s)//2 -1

ans = s[med_ind+1]-s[med_ind]

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())//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()))
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 = 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()))
A=sorted(d)
print(A[len(d)//2]-A[(len(d)//2)-1])

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

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

print(ds[midind] - ds[midind-1])

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

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-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()
m = n // 2
if d[m - 1] == d[m]:
    print(0)
    exit()
print(d[m] - d[m - 1])

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

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

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

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

d.sort()

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

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

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

    d.sort()

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

solve()

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

d_n = sorted(d_n, reverse=False)
med = int(n / 2)

count = 0
for i in range(d_n[med - 1], d_n[med], 1):
    count = count + 1
print(count)

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

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

a = l[:int(n/2)]
b = l[int(n/2):]

x = b[0] - a[len(a)-1]

print(x)

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,*L=map(int,read().split())
L.sort()
num=abs(L[n//2-1]-L[n//2])
print(num)

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

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

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

Ds.sort()

D1, D2 = Ds[N//2-1], Ds[N//2]

print(D2-D1)

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

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

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

Solution (Python):
a=int(input())
list1=list(map(int,input().split()))
list1.sort(reverse=True)
b=len(list1)//2
ans=list1[b-1]-list1[b]
print(ans)

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

Solution (Python):
import math
import sys
n = int(input())
li = list(map(int, input().split()))
li.sort()
if (len(li) % 2 == 0):
    print(li[len(li)//2] - li[len(li)//2 - 1])
else:
    print(0)

Solution (Python):
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd 
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) 







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

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

Solution (Python):
import bisect
N = int(input())
d = list(map(int, input().split()))
d = sorted(d)
mn = min(d)
mx = max(d)
ans = 0
for i in range(mn, mx+1):
  idx = bisect.bisect_left(d, i)
  if idx == N//2:
    ans += 1
print(ans)

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

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

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

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

if T[N//2]==T[(N-2)//2]:
  print("0")
else:
  print(T[N//2]-T[(N-2)//2])

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

Solution (Python):
import math
import sys
n = int(input())
li = list(map(int, input().split()))
li.sort()
ans=0
if (len(li) % 2 == 0):
    ans = li[len(li)//2] - li[len(li)//2 - 1]
print(ans)

Solution (Python):

def inputlist(): return [int(k) for k in input().split()]

N = int(input())
d = inputlist()
d.sort()
i1 = N//2
i0 = i1-1
print(d[i1]-d[i0])

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

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

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


div = int(n / 2)


if len(d) % 2 == 0:
    print(d[div] - d[div-1])
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(int(x) for x in input().split())
d.sort()

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

m=n//2

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

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

m=n//2

if a[m] == a[m-1] :print(0);exit()

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

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

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

l=a[N//2 -1]
r=a[N//2]

print(r-l)

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

problemList = sorted(problemList)
mid = N // 2

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

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

Solution (Python):
N = int(input())
D = list(map(int,input().split()))
Semi = 0
i = 0
D.sort()
while i != N//2:
    Semi = D[i]
    i += 1
if len([el for el in D if el > Semi]) != N//2:
    print(0)
else:
    print(min([el for el in D if el > Semi])-Semi)

Solution (Python):
def elip():
    return map(int,input().split())
N = int(input())
D = list(elip())
Semi = 0
i = 0
D.sort()
while i != N//2:
    Semi = D[i]
    i += 1
if len([el for el in D if el > Semi]) != N//2:
    print(0)
else:
    print(min([el for el in D if el > Semi])-Semi)

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

d_list = [int(x) for x in input().split()]
d_list.sort()

n >>= 1
ans = d_list[n] - d_list[n - 1]
print(ans)

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

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

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

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

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

d.sort()

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

print(b-a)

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

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()
l = len(d)

mi = d[l//2 - 1] + 1
ma = d[l//2]

ans = ma - mi + 1
if ans >= 0:
    print(ans)
else:
    print(0)

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

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

sd = sorted(d)
law = sd[N//2 -1]
high = sd[N//2]

print(high - law)

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

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

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

d = sorted(d)
l = len(d)

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

else:
    print(0)

Solution (Python):

"""
Created on Wed Apr 22 00:34:54 2020

@author: Kanaru Sato
"""

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

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

Solution (Python):


int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solve():
    n = II()
    D = LI()

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


if __name__ == '__main__':
    solve()

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 9)
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

from collections import deque

def solve():
    n = II()
    D = deque(sorted(LI()))

    for i in range(n):
        l = D.popleft()
        
        if len(D) == 0:
            print(1)
            break
        else:
            r = D.pop()
            
            if len(D) == 0:
                print(r - l)
                break
            else:
                continue




if __name__ == '__main__':
    solve()

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

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

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

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

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

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


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





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