program divide_the_problems
    implicit none
    integer(4):: n, harf_n
    integer(4),allocatable:: d(:)

    read*, n
    allocate(d(n))
    read*, d(:)
    call merge_sort(d(:),1,n)

    harf_n = n/2

    if (d(harf_n) == d(harf_n+1)) then
        print*, 0
    else
        print*, d(harf_n+1)-d(harf_n)
    end if


contains
recursive subroutine merge_sort(ar,fst,lst)
    integer(4):: ar(:), fst, lst, mid, tmp

    if (lst - fst < 2) then
        if (ar(lst) < ar(fst))then
            tmp = ar(fst)
            ar(fst) = ar(lst)
            ar(lst) = tmp
        end if
        return
    end if

    mid = (fst+lst)/2
    call merge_sort(ar, fst, mid)
    call merge_sort(ar, mid+1, lst)
    call merge_(ar, fst, mid, lst)
end subroutine

subroutine merge_(ar, fst, mid, lst)
    integer(4):: ar(:), fst, mid, lst
    integer(4):: ti, li, ri
    integer(4),allocatable:: tmp(:)

    allocate(tmp(lst-fst+1))
    ti=1
    li=fst
    ri=mid+1

    do while(li <= mid .and. ri <= lst)
        if (ar(li) <= ar(ri)) then
            tmp(ti) = ar(li)
            li=li+1
        else
            tmp(ti) = ar(ri)
            ri=ri+1
        end if
        ti=ti+1
    end do

    if (ri > lst)then
        tmp(ti:) = ar(li:mid)
    else
        tmp(ti:) = ar(ri:lst)
    end if

    ar(fst:lst) = tmp(:)
    deallocate(tmp)
end subroutine
end program divide_the_problems