_ = gets.to_i
a,b = gets.split.map(&:to_i)
s = gets.split.map(&:to_i)
x = s.count{_1 <= a}
y = s.count{_1 >= (b + 1)}
z = s.count - x - y
c = [x, y, z]
num = 0
while c.count{_1 <= 0} == 0
  num += 1
  c = c.map{_1 - 1}
end
puts num
