n = gets.to_i
ab = gets.chomp.split(" ").map{|a| a.to_i}
a = ab[0]
b = ab[1]
pp = gets.chomp.split(" ").map{|a| a.to_i}

array =Array.new(3)
array.map!{Array.new}
pp.each do |p|
  if p <=a
    array[0].push(p)
  elsif
    a+1<= p && p <= b
    array[1].push(p)
  else
    array[2].push(p)
  end
end
abc=[]
array.each do |ary|
  abc.push(ary.size)
end
p abc.min
