n = gets.to_i
DS = gets.split.map(&:to_i)
def median(a)
  return a[a.size/2]
end
def fplus(m)
  left = DS.select{|i| i < m}.sort
  right = DS.select{|i| i >= m}.sort
  while(left.length != right.length) do
  	if left.length < right.length
		left << right.first
    	right.delete_at(0)
  	elsif left.length > right.length
    	right << left.last
    	left.delete_at(left.length-1)
  	end
  end
  return right.sort.first - left.sort.last
end
puts fplus(median(DS))
