CodeEff/ECCO huggingface dataset:
# Original solution
N = int(eval(input()))
X = list(map(int,input().split()))
Y = sorted(list(set(X)))
Z = [X.count(y) for y in Y]
cnt = 0
for i in range(len(Y)):
    cnt += Z[i] 
    if cnt == N//2:
        cnt = Y[i+1] - Y[i]
        break
    elif cnt > N//2:
        cnt = 0
        break
print(cnt)

# Optimized solution
N = int(eval(input()))
X = sorted(list(map(int,input().split())))
print((X[N//2]-X[N//2-1]))
# Original solution
n = int(eval(input()))
l = list(map(int, input().split()))
k = max(l)

ans = 0
for i in range(k + 1):
    ar = 0
    ab = 0
    for j in l:
        if j >= i:
          ar += 1
        else:
            ab += 1
    if ar == ab:
        ans += 1
print(ans)


# Optimized solution
n = int(eval(input()))
l = list(map(int, input().split()))
k = max(l)

a = sorted(l)
print((a[n // 2] - a[n // 2 - 1]))
# Original solution
n = int(eval(input()))
arr_input = list(map(int,input().split()))

arr = sorted(arr_input)
i = int(n/2)

ans = arr[i] - arr[i-1]

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


# Optimized solution
n = int(eval(input()))
arr_in = list(map(int,input().split()))

arr = sorted(arr_in)

n = int(n/2)

res =  arr[n] - arr[n-1]
print(res)
# Original solution
n=int(eval(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)

# Optimized solution
n=int(eval(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)
# Original solution
# C
N = int(eval(input()))
D = sorted(list(map(int, input().split())))
center = len(D)//2
cnt = 0
for k in range(min(D), max(D)+1):
    for i in range(len(D)):
        if D[i] >= k:
            break
    if center == i:
        cnt += 1
print(cnt)


# Optimized solution
# C
import math
N = int(eval(input()))
D = sorted(list(map(int, input().split())))
print((D[math.ceil((N)/2)] - D[math.ceil((N)/2)-1]))
# Original solution
n = int(eval(input()))
d = list(map(int, input().split()))
d.sort()
k_count = 0
for i in range(len(d)):
    arc = len(list([x for x in d if x > d[i]]))
    abc = len(list([x for x in d if x <= d[i]]))
    if arc == abc:
        k_count += (d[i+1] - d[i])
print(k_count)

# Optimized solution
n = int(eval(input()))
d = list(map(int, input().split()))
d.sort()
k_count = 0
i = n // 2 - 1
arc = len(list([x for x in d if x > d[i]]))
abc = len(list([x for x in d if x <= d[i]]))
if arc == abc:
    k_count += (d[i+1] - d[i])
print(k_count)
# Original solution
n = int(eval(input()))
d = list(map(int, input().split()))
ans = 0

for i in range(max(d)):
    low = len([x for x in d if x > i])
    if low == n - low:
        ans += 1
print(ans)

# Optimized solution
n = int(eval(input()))
d = list(map(int, input().split()))
ans = 0
d.sort()
low = d[:len(d)//2][-1]
high = d[len(d)//2:][0]

print((high - low))
# Original solution
n = int(eval(input()))
d = list(map(int, input().split()))
way = 0
for k in range(1,max(d)+1):
    arc = 0
    abc = 0
    for di in d:
        if di >= k:
            arc += 1
        else:
            abc += 1
    if arc == abc:
        way += 1
print(way)


# Optimized solution
n = int(eval(input()))
d = list(map(int, input().split()))
d.sort()
print((d[int(n/2)] - d[int(n/2)-1]))
# Original solution
import sys
input = sys.stdin.readline

def main():
    N = int(eval(input()))
    d = list(map(int, input().split()))
    mind = min(d)
    maxd = max(d)

    ans = 0
    for i in range(mind, maxd):
        n = sum(x > i for x in d)
        if n == N // 2:
            ans += 1


    print(ans)


main()

# Optimized solution
import sys
input = sys.stdin.readline

def main():
    N = int(eval(input()))
    d = list(map(int, input().split()))
    sod = sorted(d)


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


main()
# Original solution
N=int(eval(input()))
d=[int(x) for x in input().split()]
d.sort()
M=max(d)
A=[]
for i in range(M+1):
  A.append(len([j for j in range(N) if d[j]==i]))
count=0
c=0
while(count<N/2):
  count=count+A[c]
  c=c+1
if count!=N/2:
  print((0))
elif count==N/2:
  d=0
  while(count==N/2):
    count=count+A[c]
    c=c+1
    d=d+1
  print(d)

# Optimized solution
N=int(eval(input()))
d=[int(x) for x in input().split()]
d.sort()
print((d[int(N/2)]-d[int(N/2)-1]))
# Original solution
n = int(eval(input()))
d = list(map(int,input().split()))
d.sort()
cs = [0]
ans = 0
for i in range(d[-1]):
  cs.append(cs[i]+d.count(i))

ans = cs.count(n/2)
print(ans)

# Optimized solution
n = int(eval(input()))
d = list(map(int,input().split()))
d.sort()
cs = [0]
ans = 0
l= 0
for i in range(d[-1]):
  temp = 0
  while(True):
    if i == d[l]:
      temp += 1
      l += 1
    else:
      break

  cs.append(cs[i]+temp)

ans = cs.count(n/2)
print(ans)
# Original solution
n = int(eval(input()))

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

d_max = max(list_d)
d_min = min(list_d)

score = 0
for i in range(d_min, d_max+2):

    #abcを数える
    score1 = 0
    score2 = 0
    for j in list_d:
        if j < i:
            score1 += 1

        if j >= i:
            score2 += 1


    if score1 == score2:
        score += 1

print(score)

# Optimized solution
n = int(eval(input()))

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

list_b = list_d[:int(n/2)]
list_r = list_d[int(n/2):]
print((len(list(range(list_b[-1] + 1, list_r[0] + 1)))))
# Original solution
a = int(eval(input()))
b = [int(i) for i in input().split()]
b.sort()
if b[a // 2 - 1] == b[a // 2]:
    print((0))
else:
    print((b[a // 2] - b[a // 2 - 1]))

# Optimized solution
a = int(eval(input()))
b = list(map(int, input().split()))
b.sort()
for i in range(a//2, a):
    print((b[i]-b[i-1]))
    exit()
# Original solution
from bisect import bisect_left

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

for i in range(1,10**5+1):
  p=bisect_left(d,i)
  ans+=1 if p==(n-p) else 0

print(ans)

# Optimized solution
n=int(eval(input()))
d=sorted(list(map(int,input().split())))
ans=d[n//2]-d[n//2-1]
print(ans)
# Original solution
n = int(eval(input()))
d = list(map(int, input().split()))
d = sorted(d)

banken = 1
for item in d:
    if len(d[:banken]) == len(d[banken:]):
        break
    if banken >= len(d):
        break
    banken += 1

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


# Optimized solution
n = int(eval(input()))
d = list(map(int, input().split()))
d = sorted(d)

banken = len(d) // 2
print((d[banken] - d[banken-1]))
# Original solution
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(eval(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)



# def main():

# if __name__ == '__main__':
#     main()


# Optimized solution
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(eval(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((D[N // 2] - D[N // 2 - 1]))
# Original solution
#!/usr/bin/env python3
import sys


def solve(N: int, d: "List[int]"):
    b = [0] * (10**5 +1)
    for i in range(N):
        b[d[i]] += 1
    t = 0
    f = False
    ans = 0
    for i in range(1, 10 ** 5 + 1):
        if not f:
            t += b[i]
            if t == N / 2:
                f = True
            elif t > N / 2:
                ans = 0
                break
        else:
            ans += 1
            if b[i] != 0:
                break
    print(ans)



    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    d = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, d)

if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python3
import sys


def solve(N: int, d: "List[int]"):
    d.sort()
    abc = d[int(N/2)-1]
    arc = d[int(N/2)]
    print((arc-abc))

    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    d = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, d)

if __name__ == '__main__':
    main()
# Original solution
from bisect import bisect_left

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

to_take = N // 2

cnt = 0
for x in range(d[0], d[-1] + 1):
    idx = bisect_left(d, x)
    # ABC用の問題数
    if idx == to_take:
        cnt += 1
print(cnt)


# Optimized solution
n = int(eval(input()))
d = list(map(int, input().split()))
d.sort()

print((d[n // 2] - d[n // 2 - 1]))
# Original solution
import sys
sys.setrecursionlimit(10 ** 9)
int1 = lambda x: int(x) - 1
def II(): return int(eval(input()))

def MI(): return list(map(int, input().split()))
def MI1(): return list(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()
        # print('l', l)
        if len(D) == 0:
            print((1))
            break
        else:
            r = D.pop()
            # print('r', r)
            if len(D) == 0:
                print((r - l))
                break
            else:
                continue




if __name__ == '__main__':
    solve()


# Optimized solution
# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(eval(input()))

def MI(): return list(map(int, input().split()))
def MI1(): return list(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()
# Original solution
n=int(eval(input()))
# print(n)
di=[]
for i in map(int,input().split()):
    di.append(i)
di.sort()
n1=int(n/2)
m=di[n1] -di[n1-1]
print(m)

# Optimized solution

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

d.sort()

print((d[n//2]-d[n//2-1]))
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
a=sorted(a)
print((a[n//2]-a[(n//2)-1]))

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
a=sorted(a)
l=n//2-1
r=n//2
print((a[r]-a[l]))
# Original solution
# coding: utf-8
N = int(eval(input()))
d = list(map(int, input().split()))
d.sort()
idx = len(d) // 2
l = d[idx-1]
r = d[idx]
print((r - l))

# Optimized solution
# coding: utf-8
N = int(eval(input()))
d = list(map(int, input().split()))
d.sort()
idx = N // 2
print((d[idx] - d[idx-1]))
# Original solution
n = int(eval(input()))
A = sorted(list(map(int, input().split())))
leng = len(A)//2
print((A[leng] - A[leng-1]))

# Optimized solution
N = int(eval(input()))
A = sorted(map(int, input().split()))

ans = A[N//2] - A[N//2-1]
print(ans)
# Original solution
input_line=int(eval(input()))
ARC = [int(i)for i in input().split()]
count=0
for i in range(10**5):
  AARC = ARC
  for s in ARC:
    if s<i:
      while s in AARC:
        AARC.remove(s)
  if (input_line//2)== len(AARC):
    count+=1

print(count)

# Optimized solution
input_line=int(eval(input()))
ARC = [int(i)for i in input().split()]
ARC.sort()
middle = input_line //2
s = ARC[middle]-ARC[middle-1]

print(s)
# Original solution
n = int(eval(input()))
d = list(map(int,input().split()))
k_max = max(d)
k_min = min(d)
result = 0
for k in range(k_min,k_max+1):
    count = 0
    for i in range(n):
        if d[i] >= k:
            count += 1
        if count > n//2:
            break
    if count == n//2:
        result += 1
print(result)

# Optimized solution
n = int(eval(input()))
d = list(map(int,input().split()))
d.sort()
l = d[n//2 -1]
r = d[n//2]
print((r - l))
# Original solution
n = int(eval(input()))
d = list(int(x) for x in input().split())

ans = 0

for k in range(1, max(d) + 1):
    arc_num = 0
    abc_num = 0
    for i in range(n):
        if d[i] >= k:
            arc_num += 1
        else:
            abc_num += 1
    if arc_num == abc_num:
        ans += 1

print(ans)

# Optimized solution
import bisect

n = int(eval(input()))
d = list(int(x) for x in input().split())
d.sort()

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

"""
for k in range(d[n // 2], d[(n // 2) + 1]):
    if bisect.bisect_left(d, k) == n // 2:
        ans += 1
"""
# Original solution
import sys
import math
N = int(eval(input()))
d = list(map(int, input().split()))


ans = 0

for i in range(min(d),max(d) + 1):
    ARC = 0
    ABC = 0
    for j in range(N):
        if d[j] < i:
            ARC = ARC + 1
        else:
            ABC = ABC + 1
    if ABC == ARC:
        ans = ans + 1 

print(ans)
             

# Optimized solution
N = int(eval(input()))
d = sorted(list(map(int, input().split())))
print((d[N // 2] - d[N // 2 - 1]))
# Original solution
N = int(eval(input()))
d = list(map(int, input().split()))
d.sort()
harf_N = int(N/2)
print((d[harf_N] - d[harf_N - 1]))

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
#print(n)
a.sort()
#print(a)
print((a[int(n/2)]-a[int(n/2)-1]))
# Original solution
n = int(eval(input()))
d = [int(i) for i in input().split()]

ans = 0
d.sort()

for k in range(n):
	abc = d[0:k]
	arc = d[k:n]
	if len(abc) == len(arc):
		ans = d[k] - d[k-1] 
print(ans)

# Optimized solution
n = int(eval(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)
# Original solution
N = int(eval(input()))
ds = input().split()
ds = [int(i) for i in ds]
ds.sort()
#print(ds)
#if ds[int(N/2)] == ds[int(N/2)+1]:
#  print("0")
#else:
print((ds[int(N/2)]-ds[int(N/2)-1]))

# Optimized solution
N = int(eval(input()))
ds = input().split()
ds = [int(i) for i in ds]
ds.sort()
print((ds[int(N/2)]-ds[int(N/2)-1]))
# Original solution
N = int(eval(input()))
d = [int(i) for i in input().split()]
K = max(d)
ans = 0

for i in range(K+1):
    temp_abc = 0
    temp_arc = 0
    for j in range(N):
        if d[j] >= i:
            temp_abc += 1
        else:
            temp_arc += 1
    if temp_abc == temp_arc:
        ans += 1

print(ans)


# Optimized solution
N = int(eval(input()))
d = [int(i) for i in input().split()]
D = sorted(d)

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

print(ans)
# Original solution
n = int(eval(input()))
d = list(map(int,input().split()))
d = sorted(d)
length = len(d) // 2
count = 0
for k in range(d[length - 1], d[length] + 1):
    min = sum(x<k for x in d)
    max = sum(x>=k for x in d)
    if min == max:
        count += 1
print(count)

# Optimized solution
n = int(eval(input()))
d = list(map(int,input().split()))
d = sorted(d)
length = len(d) // 2
max = d[length]
min = d[length - 1]
print((max - min))
# Original solution
n = int(eval(input()))
lst = [int(i) for i in input().split()]
lst = sorted(lst)
cnt = 0
d = int(n/2-1)
l = lst[d]
u = lst[d+1]
   
if l==u:
    cnt = 0
else:
    cnt = u-l
print(cnt)

# Optimized solution
n = int(eval(input()))
lst = sorted(list(map(int,input().split())))
l,r = lst[n//2-1],lst[n//2]
if l == r:
    print((0))
else:
    print((r-l))
# Original solution
N = int(eval(input()))
d = list(map(int, input().split()))

d = sorted(d)

m = d[N // 2 - 1]
l = d[N // 2]

print((l-m))

# Optimized solution
import sys
input = sys.stdin.readline

N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
print((A[N//2]-A[N//2-1]))
# Original solution
# -*- coding:utf-8 -*-

def solve():
    N = int(eval(input()))
    D = list(map(int, input().split()))
    D.sort()

    """
    1 4 4 | 6 7 9　OK

    1 4 4 | 4 7 9　だめ

    1 2 3 | 3 7 9  だめ
    """

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

    print(ans)


if __name__ == "__main__":
    solve()


# Optimized solution
# -*- coding:utf-8 -*-

def solve():
    N = int(eval(input()))
    D = list(map(int, input().split()))

    D.sort()
    i = N//2

    if D[i] != D[i-1]:
        # 同じ数になるように分けることが可能
        print((D[i]-D[i-1]))
        return
    print((0))
    

if __name__ == "__main__":
    solve()
# Original solution
N = int(eval(input()))
D = list(map(int, input().split()))
dic = {}
ABCs = 0
count = 0

for i in range(N):
    if D[i] in dic:
        dic[D[i]] += 1
    else:
        dic[D[i]] = 1

diffs = sorted(dic.keys())

for i in range(diffs[-1]+1):
    if i in dic:
        ABCs += dic[i]
    if ABCs == N / 2:
        count += 1

print(count)


# Optimized solution
N = int(eval(input()))
D = list(map(int, input().split()))
dic = {}
ABCs = 0
count = 0
flag = 0

for i in range(N):
    if D[i] in dic:
        dic[D[i]] += 1
    else:
        dic[D[i]] = 1

diffs = sorted(dic.keys())

for k in range(diffs[-1]+1):
    if flag == 0:
        if ABCs == N / 2:
            count += 1
            flag += 1
    else:
        if ABCs > N / 2:
            break
        count += 1

    if k in dic:
        ABCs += dic[k]

print(count)
# Original solution
n=int(eval(input()))
d_s=input().split()
d=[int(x) for x in d_s]
judge=0
count=0
for i in range(1,100000):
  for x in d:
    if x==i:
      count+=1
  if count==n/2:
    judge+=1
  elif count>n/2:
    break
print(judge)

# Optimized solution
n=int(eval(input()))
d_s=input().split()
d_i=[int(x) for x in d_s]
d=sorted(d_i)
k=d[int(n/2)]
t=d[int(n/2)-1]
print((k-t))
# Original solution
import sys

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

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

low  = D[0:N//2]
high = D[N//2::]

cnt = 0
flg = True
for i in range(low[-1], min(high) + 1):
    flg = True
    for L in low:
        if i <= L:
            flg = False
    for L in high:
        if i > L:
            flg = False

    if flg == True:
        cnt = cnt + 1
print(cnt)



# Optimized solution
import sys

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

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

low  = D[0:N//2]
high = D[N//2::]

flg  = all( low[-1] + 1 >  x for x in low )
flg |= all( high[0] - 1 >= x for x in high )

if flg == True:
    print((high[0] - low[-1]))
else:
    print((0))
# Original solution
N=int(eval(input()))
D=list(map(int,input().split()))
cnt=0
for i in range(min(D),max(D)+1):
    c=[]
    for d in D:
        if d>=i:
            c.append(d)
    if len(c)==N//2:
        cnt+=1
print(cnt)

# Optimized solution
n=int(eval(input()))
D=list(map(int,input().split()))
D=sorted(D,reverse=True)
print((D[n//2-1]-D[n//2]))
# Original solution
n = int(eval(input()))
d = list(map(int,input().split()))
arc = []
abc = []
cnt = 0
if n % 2 == 1:
    print((0))
    exit()
d.sort()
right = n // 2
left = right - 1
for i in range(d[left],d[right]+1):
    k = i
    abc = []
    arc = []
    for j in d:
        if j >= k:
            arc.append(j)
        elif j < k:
            abc.append(j)
    if len(arc) == len(abc):
        cnt += 1
print(cnt)


# Optimized solution
n = int(eval(input()))
d = list(map(int,input().split()))
arc = []
abc = []
cnt = 0
d.sort()
pivot = n//2
k = d[pivot]
for i in range(n):
    if d[i] >= k:
        arc.append(d[i])
    elif d[i] < k:
        abc.append(d[i])
if len(arc) == len(abc):
    cnt = d[pivot] - d[pivot-1]
print(cnt)
# Original solution
N = int(eval(input()))
d = list(map(int, input().split()))
count = 0
d.sort()
for i in range((N-2)//2):
    d = d[1:]
    d = d[:-1]
print((d[1]-d[0]))


# Optimized solution
N = int(eval(input()))
d = list(map(int, input().split()))
count = 0
d.sort()
print((d[N//2]-d[N//2-1]))
# Original solution
N = int(eval(input()))
D = [int(i) for i in input().split()]

cnt = 0


for i in range(1,max(D)+1):
	arc = []
	abc = []
	for j in range(len(D)):
		if D[j] > i:
			arc.append(D[j])
		else:
			abc.append(D[j])
		#print(abc, arc)
	if len(arc) == len(abc):
		cnt += 1

print(cnt)

# Optimized solution
N = int(eval(input()))
D = [int(i) for i in input().split()]
D.sort()
print((D[N//2] - D[N//2-1]))
# Original solution
n=int(eval(input()))
a=sorted(list(map(int,input().split())))

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

# Optimized solution
n=int(eval(input()));l=sorted(map(int,input().split()));print((l[n//2]-l[n//2-1]))
# Original solution
from collections import Counter

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

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

print(ans)

# Optimized solution
N = int(eval(input()))
d = sorted(list(map(int, input().split())), reverse=True)

print((d[N//2-1] - d[N//2]))
# Original solution
N = int(eval(input()))
L = list(int(i) for i in input().split()) 
n = N//2
cnt = 0
data = sorted(L)
data1 = data[:n]
data2 = data[n:]
for i in range(100000):
    if max(data1) < i and i <= min(data2):
        cnt += 1
print(cnt)

# Optimized solution
N = int(eval(input()))
L = list(int(i) for i in input().split()) 
n = N//2
data = sorted(L)
data1 = data[:n]
data2 = data[n:]
print((min(data2) - max(data1)))
# Original solution
n = int(eval(input()))
d_lis = [int(d) for d in input().split()]
cnt = 0
ans = 0
for i in range(max(d_lis)+1):
    cnt += d_lis.count(i)
    if cnt == n // 2:
        ans += 1
print(ans)

# Optimized solution
n = int(eval(input()))
d_lis = list(map(int,input().split()))
li = sorted(d_lis)
mid = n // 2
print((li[mid] - li[mid-1]))
# Original solution
n = int(eval(input()))
d = [int(i) for i in input().split()]

c = 0

for k in range(1,max(d)+1):
	arc = []
	abc = []
	for j in range(len(d)):
		if d[j] >= k:
			arc.append(d[j])
		else:
			abc.append(d[j])
	
	if len(abc) == len(arc):
		c += 1

print(c)

# Optimized solution
n = int(eval(input()))
d = [int(i) for i in input().split()]

d.sort()

ans = d[len(d)//2] - d[len(d)//2-1]
print(ans)
# Original solution
N=int(eval(input()))
d=list(map(int,input().split()))
n=0
for k in range(1,10**5+1):
  m=0
  for b in d:
    if b<k:
      m+=1
  if m==N/2:
    n+=1
print(n)

# Optimized solution
N=int(eval(input()))
d=sorted(list(map(int,input().split())))
print((d[int(N/2)]-d[int(N/2-1)]))
# Original solution
n = int(eval(input()))
d = list(map(int, input().split()))
d.sort()
print((d[n // 2] - d[n // 2 - 1]))


# Optimized solution
n = int(eval(input()))
a = sorted(list(map(int, input().split())))
m = n // 2
print((a[m] - a[m - 1]))
# Original solution
n = int(eval(input()))
m = n//2
D = list(map(int, input().split()))
D.sort()
D.reverse()
if D[m-1] == D[m]:
  print((0))
  exit()
else:
  print((D[m-1]-D[m]))
  exit()

# Optimized solution
n = int(eval(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]))
# Original solution
a = int(eval(input()))
b = list(map(int,input().split()))
c = sorted(b)
print((c[int(0.5*a)]-c[int(0.5*a-1)]))

# Optimized solution
N = int(eval(input()))
D = sorted(map(int,input().split()))
print((max(0,D[N//2]-D[N//2-1])))