You have written N problems to hold programming contests. The i-th problem will have a score of P_i points if used in a contest.  With these problems, you would like to hold as many contests as possible under the following condition:    * A contest has three problems. The first problem has a score not greater than A points, the second has a score between A + 1 and B points (inclusive), and the third has a score not less than B + 1 points.  The same problem should not be used in multiple contests. At most how many contests can be held?
def resolve():
    n = int(input())
    a, b = map(int, input().split())
    p = list(map(int, input().split()))
    low, mid, high = 0, 0, 0
    for pi in p:
        if pi <= a:
            low += 1
        elif a + 1 <= pi <= a:
            mid += 1
        else:
            high += 1
    print(min(low, mid, high))


if __name__ == "__main__":
    resolve()

def resolve():
    n = int(input())
    a, b = map(int, input().split())
    p = list(map(int, input().split()))
    low, mid, high = 0, 0, 0
    for pi in p:
        if pi <= a:
            low += 1
        elif a + 1 <= pi <= b:
            mid += 1
        else:
            high += 1
    print(min(low, mid, high))


if __name__ == "__main__":
    resolve()
