#!/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()

#!/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()

#!/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()

#!/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()

-    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) +    d.sort() +    abc = d[int(N / 2) - 1] +    arc = d[int(N / 2)] +    print((arc - abc))