implicit none
integer:: n, i, j, a, b, count_1, count_2, count_3
integer,allocatable,dimension(:):: p

read(5,*) n, a, b
allocate(p(n))
read(5,*) (p(i),i=1,n)

count_1 = 0
count_2 = 0
count_3 = 0

do i = 1, n
    if (p(i) <= a) then
        count_1 = count_1 + 1
    else if (p(i) <= b) then
        count_2 = count_2 + 1
    else
        count_3 = count_3 + 1
    endif
enddo

write(6,*) min(count_1, count_2, count_3)

end