import sys

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

read = sys.stdin.buffer.read

sys.setrecursionlimit(10 ** 7)



N = int(eval(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)
import sys

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

read = sys.stdin.buffer.read

sys.setrecursionlimit(10 ** 7)



N = int(eval(input()))

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

D.sort()



num = N // 2

ans = D[num] - D[num-1]

print(ans)
import sys

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10**7)
N = int(eval(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)

import sys

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10**7)
N = int(eval(input()))
D = list(map(int, input().split()))
D.sort()
num = N // 2
ans = D[num] - D[num - 1]
print(ans)

-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 +ans = D[num] - D[num - 1]