n=gets.chomp.to_i
a,b=gets.chomp.split(" ").map { |e| e.to_i }
p=gets.chomp.split(" ").map { |e| e.to_i }

ap = 0
bp = 0
cp = 0

for item in p do
  if item <= a
    ap += 1
  elsif a+1 <= item && item <= b
    bp += 1
  else
    cp += 1
  end
end

puts [ap, bp, cp].min
