n = gets.chomp.to_i
a,b = gets.chomp.split(/\s/).map{|x| x.to_i}
pn = gets.chomp.split(/\s/).map{|x| x.to_i}

cnt = 0

for i in 1..n/3
    found = false
    for j in 0..(pn.length-1)
        if pn[j] <= a
            found = true
            pn.delete_at(j)
            break
        end
    end
    break unless found
    break if pn.length == 0

    found = false
    for j in 0..(pn.length-1)
        if (a+1) <= pn[j] and pn[j] <= b
            found = true
            pn.delete_at(j)
            break
        end
    end
    break unless found
    break if pn.length == 0

    found = false
    for j in 0..(pn.length-1)
        if b+1 <= pn[j]
            found = true
            pn.delete_at(j)
            break
        end
    end
    break unless found

    cnt += 1
    break if pn.length == 0
end

puts cnt