program main
  implicit none
  integer i,N,al,av
  integer,allocatable :: d(:)
  !read(*, *) (L(i), i = 1,N)
  read(*, *) N
  allocate(d(N))
  read(*, *) (d(i), i = 1,N)
  call qsort(d)
  write(*, *) abs(d(N/2)-d(N/2+1)) + 1

  contains

  recursive subroutine qsort(a)
  implicit none
  integer,intent(inout) :: a(:)
  integer :: start,ed,i,j,toobig,toosmall,pv

  n = size(a)
  start = 1
  ed = n
  pv = a((start+ed)/2)
  i = start
  j = ed
  do
     !pv = a((start+ed)/2)
     !i = start
     !j = ed
     do
       if (a(i) < pv) then
         i = i+1
       else
         exit
       end if
     end do
     do
       if(a(j) > pv) then
         j = j-1
       else
         exit
       end if
     end do
     if (i >= j) then
       exit
     else
       toobig = a(i)
       toosmall = a(j)
       a(j) = toobig
       a(i) = toosmall
       i = i + 1
       j = j - 1
     end if
   end do
  if (i-1 > start) then
    call qsort(a(1:i-1))
  end if
  if (j+1 < ed) then
    call qsort(a(j+1:n))
  end if
  end subroutine qsort
  
end program main
