Problem:
 Score : 200 points    Problem Statement 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?      Constraints  3 \leq N \leq 100  1 \leq P_i \leq 20 ( 1 \leq i \leq N )  1 \leq A < B < 20  All values in input are integers.         Input Input is given from Standard Input in the following format:  N  A  B  P_1  P_2  ...  P_N       Output Print the answer.        Sample Input 1 7
5 15
1 10 16 2 7 20 12      Sample Output 1 2  Two contests can be held by putting the first, second, third problems and the fourth, fifth, sixth problems together.       Sample Input 2 8
3 8
5 5 5 10 10 10 15 20      Sample Output 2 0  No contest can be held, because there is no problem with a score of A = 3 or less.       Sample Input 3 3
5 6
5 6 10      Sample Output 3 1

Solution (Python):
N = int(input())
A,B = map(int, input().split())
P = sorted(list(map(int,input().split())))

a,b,c = 0,0,0
for p in P:
    if p <= A:
        a += 1
    elif p <= B:
        b += 1
    else:
        c += 1

ans = min(a,b,c)
print(ans)

Solution (Python):
a = int(input())
b,c = (int(x) for x in input().split())
lis =[]
lis = input().split()
lis = [int(s) for s in lis]

d = int(0)
e = int(0)
f = int(0)

for i in range(a):
  if lis[i] <= b:
    d += 1 
  elif b+1 <= lis[i] <= c:
    e += 1
  else:
    f += 1

if min(d,e,f,) > 0:
  print(min(d,e,f,))
else:
  print(0)

Solution (Python):
import sys

lines = sys.stdin.readlines()

N = int(lines[0])
A, B = map(int, lines[1].split())
Ps = [int(n) for n in lines[2].split()]

Ps.sort()

count = 0

p_p1 = [x for x in Ps if x <= A]
p_p2 = [x for x in Ps if (x >= A + 1) and (x <= B)]
p_p3 = [x for x in Ps if x >= B + 1]





print(min([len(p_p1), len(p_p2), len(p_p3)]))

Solution (Python):
n = int(input())
list1 = list(map(int,input().split()))
list2=list(map(int,input().split()))

a = list1[0]
b = list1[1]

num0 = sum([1 for p in list2 if p <=a])
num2 = sum([1 for p in list2 if p > b])
num1 = n - num0 -num2
print(min([num0,num1,num2]))

Solution (Python):








N = int(input())

a = input().rstrip().split(" ")
A = int(a[0])
B = int(a[1])

P = input().rstrip().split(" ")

f = []
for i in range(len(P)):
    if int(P[i]) <= A:
        f.append(int(P[i]))

s = []
for i in range(len(P)):
    if int(P[i]) > A and int(P[i]) <= B:
        s.append(int(P[i]))

t = []
for i in range(len(P)):
    if int(P[i]) > B:
        t.append(int(P[i]))

sum = 0
if len(f) > len(s):
    if len(s) > len(t):
        sum = len(t)
    else:
        sum = len(s)
elif len(f) > len(t):
    sum = len(t)
else:
    sum = len(f)

print(sum)

Solution (Python):
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))

x = len([i for i in p if i <= a])
y = len([i for i in p if a < i <= b])
z = len([i for i in p if i > b])
print(min(x, y, z))

Solution (Python):
n = int(input())
listAB = list(map(int,input().split()))
listP=list(map(int,input().split()))

a = listAB[0]
b = listAB[1]

num0 = sum([1 for p in listP if p <=a])
num2 = sum([1 for p in listP if p > b])
num1 = n - num0 -num2
print(min([num0,num1,num2]))

Solution (Python):
N = int(input())
A, B = [int(_) for _ in input().split()]
P =  [int(_) for _ in input().split()]
x = len([i for i in P if i <= A])
y = len([i for i in P if i <= B and i >= A+1])
z = len([i for i in P if i >= B + 1])
 
if x != 0 and y != 0 and z != 0:
    print(min([x,y,z]))
else :
    print(0)

Solution (Python):
N = int(input())
A,B = map(int, input().split())
T= [int(i) for i in input().split()]
a=[i for i in T if i<=A]
b=[i for i in T if A<i<=B]
c=[i for i in T if i>B]
al=len(a)
bl=len(b)
cl=len(c)
list=[al,bl,cl]
print(min(list))

Solution (Python):
N = int(input())
(A, B) = list(map(int, input().split()))
P = list(map(int, input().split()))
COUNT = [0, 0, 0]
for i in sorted(P):
    if i <= A:
        COUNT[0] += 1
    elif i <= B:
        COUNT[1] += 1
    else:
        COUNT[2] += 1
print(min(COUNT))

Solution (Python):
n=int(input())
a,b = map(int,input().split())
p = map(int,input().split())



list1 = []
list2 = []
list3 = []

for i in p:
    if i<=a:
        list1.append(i)
    elif i<=b:
        list2.append(i)
    else:
        list3.append(i)


if len(list1)>=len(list2):
    if len(list2)>=len(list3):
        print(len(list3))
    else:
        print(len(list2))
else:
    if len(list1)>=len(list3):
        print(len(list3))
    else:
        print(len(list1))

Solution (Python):
N = int(input())
a,b = (int(x) for x in input().split())

lis = []
lis = input().split()
lis = [int(s) for s in lis]


a_num,b_num,c_num = 0,0,0

for i in range(N):

    if lis[i] <= a:
        a_num +=1
    elif lis[i] <= b:
        b_num +=1
    else:
        c_num +=1
"""
print("a_num"+str(a_num))
print("b_num"+str(b_num))
print("c_num"+str(c_num))
"""

if a_num == 0:
    print(0)
elif b_num == 0:
    print(0)
else:
    print(min(a_num,b_num,c_num))

Solution (Python):
N = int(input())
A,B=(int(x) for x in input().split())
scores = input().split()
num = [0,0,0]
for i in range(N):
    score = int(scores[i])
    if (score <= A):
        num[0] += 1
    elif(score <= B):
        num[1] += 1
    else:
        num[2] += 1
max_value = num[2]
for i in range(2):
    if max_value > num[i]:
        max_value = num[i]
print(max_value)

Solution (Python):

n = input()
a,b = map(int,input().split())
p = list(map(int,input().split()))

first=0
second=0
third=0

for i in p:
  if i <= a:
    first +=1
  elif i <= b:
    second +=1
  else:
    third +=1

print(min([first,second,third]))

Solution (Python):
l_a = []
l_ab = []
l_b = []
l = []

N = int(input())
A, B = map(int, input().split())
inputs = input().split()

for i in inputs:
    if(int(i) <= A):
        l_a.append(i)
    elif(int(i) >= A + 1 and int(i) <= B):
        l_ab.append(i)
    elif(int(i) >= B + 1):
        l_b.append(i)

l.append(len(l_a))
l.append(len(l_ab))
l.append(len(l_b))

print(min(l))

Solution (Python):
N=int(input())
A,B=map(int,input().split())
a=list(map(int,input().split()))
j=k=l=0
for i in a:
    if i<(A+1):
        j=j+1
    elif A<i<(B+1):
        k=k+1
    else:
        l=l+1
if j<k and j<l:
    print(j)
elif k<j and k<l:
    print(k)
else:
    print(l)

Solution (Python):
N = int(input())
A,B = map(int,input().split())
P = list(map(int,input().split()))
P1,P2,P3=0,0,0
for i in range(N):
    if P[i]  <= A:
        P1 += 1
    elif P[i]  <= B:
        P2 += 1
    else:
        P3 += 1
print(min(P1,P2,P3))

Solution (Python):
N = int(input())
A, B = list(map(int, input().split()))
P = list(map(int, input().split()))
P = sorted(P)
rega=0
regb=0
regc=0
for i in range(N):
    if P[i]<= A:
        rega+=1
    elif P[i] > B:
        regc+=1
    else:
        regb+=1
print(min(rega, regb, regc))

Solution (Python):
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
uA = []
oAuB = []
oB = []
for i in range(N):
    if P[i] <= A:
        uA.append(P[i])
    if A+1 <= P[i] and P[i] <= B:
        oAuB.append(P[i])
    if B+1 <= P[i]:
        oB.append(P[i])
print(min(len(uA), len(oAuB), len(oB)))

Solution (Python):

N = int(input())
A, B = [int(x) for x in input().split()]
P = [int(x) for x in input().split()]

P.sort()


for i in range(N):
    if P[i]>A: break
a = i 
for i in range(a,N):
    if P[i]>B: break
else:
    i = N
b = i - a 
c = N - i


count = min(a, b, c)
print(count)

Solution (Python):
n= int(input())
a,b = map(int,input().split())
p = input().split()
p =[int(p) for p in p]

q1 = sum(x <= a for x in p) 
q2= sum((b >= x > a)  for x in p) 
q3= sum(x > b  for x in p) 

q =[q1,q2,q3]

print(min(q))

Solution (Python):
N = int(input())
A, B = [int(_) for _ in input().split()]
P = [int(_) for _ in input().split()]
count = [0, 0, 0]
for i in range(N):
    if P[i] <= A:
        count[0] += 1
    elif P[i] <= B:
        count[1] += 1
    else:
        count[2] += 1
print(min(count))

Solution (Python):
import numpy as np

N = input()
A, B = [int(i) for i in input().split()]
P = [int(i) for i in input().split()]

P = np.array(P)
P_1 = P[P <= A]
P_2 = P[(P >= (A+1)) & (P <= B)]
P_3 = P[P > B]
print(min(len(P_1), len(P_2), len(P_3)))

Solution (Python):
num=int(input())
line=input().split(" ")
a=int(line[0])
b=int(line[1])
low=[]
middle=[]
high=[]

lines=input().split(" ")


for i in range(num):
    n=int(lines[i])
    if n<=a:
        low.append(n)
    elif n<=b:
        middle.append(n)
    else:
        high.append(n)

print(min(len(low),len(middle),len(high)))

Solution (Python):
n = int(input())
line = input().split()
a = int(line[0])
b = int(line[1])
line = input().split()
p = []
for i in range(n):
    p.append(int(line[i]))

c1 = 0
c2 = 0
c3 = 0

for i in p:
    if (i <= a):
        c1 += 1
    elif ((i >= a + 1) and (i <= b)):
        c2 += 1
    elif (i >= b +1):
        c3 += 1

print(min(c1,c2,c3))

Solution (Python):
N=int(input())
A,B=map(int,input().split())
P=[int(i) for i in input().split()]
P.sort()
a,b,c=0,0,0
for i in range(N):
  if P[i]<=A:
    a+=1
  elif A+1<=P[i]<=B:
    b+=1
  else:
    c+=1
print(min(a,b,c))

Solution (Python):

N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
P.sort()

count_a = 0
b_count = 0
i = 0
while i < N:
    if P[i] <= A:
        count_a += 1
    elif B < P[i]:
        b_count += 1
    i += 1

print(int(min(count_a, b_count, N - count_a - b_count)))

Solution (Python):
if __name__ == '__main__':
    n = int(input())
    (a, b) = [int(x) for x in input().split()]
    u1 = u2 = u3 = 0
    for s in input().split():
        x = int(s)
        if x <= a:
            u1 += 1
        elif a < x <= b:
            u2 += 1
        else:
            u3 += 1
    print(min(min(u1,u2),u3))

Solution (Python):
import bisect
n = int(input())
a, b= (int(i) for i in input().split())  
p = list(int(i) for i in input().split())
p1 = sorted(p,reverse=True)
ans1 = 0
ans2 = 0
ans3 = 0
for i in p1:
  if i <= a:
    ans1 += 1
  elif a<i and i<=b:
    ans2 += 1 
  else: 
    ans3 += 1
print (min([ans1,ans2,ans3]))

Solution (Python):
N = int(input())
A, B = (int(i) for i in input().split())  
P = [int(i) for i in input().split()] 

n1 = sum(x <= A for x in P)

n2 = len([1 for x in P if (x>A and x < B+1)])  

n3 = sum(x > B for x in P)

print(min(n1, n2, n3))

Solution (Python):
import numpy as np
N = int(input())
A, B = map(int,input().split())
P = list(map(int,input().split()))
P_1 = [i for i in P if i <= A]
P_2 = [i for i in P if i >= A + 1 and i <= B]
P_3 = [i for i in P if i >= B + 1]
P_len = np.array([len(P_1),len(P_2),len(P_3)])
print(P_len.min())

Solution (Python):
n=int(input())
a,b=(int(i) for i in input().split())
p=[int(i) for i in input().split()]


cnta=0
cntb=0
cntc=0

for i in p:
  if i<=a:
    cnta+=1
  if a+1<=i<=b:
    cntb+=1
  if b+1 <= i:
    cntc+=1
    
print(min(cnta,cntb,cntc))

Solution (Python):
n=int(input())
a,b=map(int,input().split())
p=list(map(int, input().split()))
p1 = [i for i in p if i <= a]
p2 = [i for i in p if i >= a+1 and i <= b]
p3 = [i for i in p if i >= b+1]
print(min(len(p1),len(p2),len(p3)))

Solution (Python):
N = int(input())

A,B = map(int,input().split(' '))

P = list(map(int, input().split(" ")))







P.sort()

kazu = len(P)



A_cnt = 0
B_cnt = 0

for j in range(N):
    if P[j] <= A:
        A_cnt = A_cnt +1
    if P[j] >= B+1:
        B_cnt = B_cnt + 1

AB_cnt = kazu - A_cnt - B_cnt

print(min(A_cnt,B_cnt,AB_cnt))

Solution (Python):
from sys import stdin
n = int(stdin.readline().rstrip())
ab = [int(i) for i in stdin.readline().rstrip().split(" ")]
p = [int(i) for i in stdin.readline().rstrip().split(" ")]

first = len([i for i in p if i <= ab[0]])
third = len([i for i in p if i > ab[1]])
second = n - first - third
print(min([first,second,third]))

Solution (Python):
N = int(input())
A,B = map(int,input().split())
P=list(map(int,input().split()))
a = sum(x<=A for x in P)
b = sum(x<=B and x>A for x in P) 
c = sum(x>B for x in P)

print(min(a,b,c))

Solution (Python):
N = int(input())
A, B = map(int, input().split())
p = list(map(int, input().split()))


x = 0
y = 0
z = 0

for i in sorted(p):
  if i <= A:
    x += 1
  elif i <= B:
    y += 1
  else:
    z += 1
    
print(min(x,y,z))

Solution (Python):
import numpy as np

n=int(input())
a,b=map(int,input().split())
p=list(map(int,input().split()))

p = np.array(p)
print(min(len(p[p <= a]),len(p[(p > a) & (p <= b)]),len(p[p > b])))

Solution (Python):
n = int(input())
a, b = map(int, input().split())
p = sorted(map(int, input().split()))
max_contest = n // 3
count = 0
for i in range(max_contest):
    
    
    can_b = [i for i in p if a+1 <= i <= b]
    if p[0] <= a and p[-1] >= b+1 and len(can_b) != 0:
        count += 1
        del p[0]
        p.remove(can_b[0])
        del p[-1]
    else:
        break
print(count)

Solution (Python):
N = int(input())
a,b = map(int,input().split())

P = list(map(int,input().split()))

 
A = []
B = []
C = []
for i in P:
    if i<=a:
        A.append(i)
    elif i<=b:
        B.append(i)
    else :
        C.append(i)

ans = min([len(A),len(B),len(C)])
print(ans)

Solution (Python):
N = int(input())
A, B = map(int, input().split())
Ps = list(map(int, input().split()))

LOW = []
MID = []
HIG = []

for p in Ps:
    if p <= A:
        LOW.append(p)
    elif p <= B:
        MID.append(p)
    else:
        HIG.append(p)

ll = len(LOW)
lm = len(MID)
lh = len(HIG)

print(min(ll, lm, lh))

Solution (Python):


n = map(int, input().split())
a,b = map(int, input().split())
p = list(map(int, input().split()))

bottom=0
middle=0
upper=0
for pi in p:
  if pi <= a:
    bottom=bottom+1
  elif pi <= b:
    middle=middle+1
  else:
    upper=upper+1
print(min(bottom,min(middle,upper)))

Solution (Python):
import numpy as np
N = int(input())
A, B = map(int,input().split())
p = np.array(list(map(int,input().split())))
a = p[p<=A].shape[0]
b = p[np.logical_and(p>A,p<=B)].shape[0]
c = p[p>B].shape[0]
print(np.min(np.array([a,b,c])))

Solution (Python):
N = int(input())
A,B = map(int,input().split())
P = input().split(' ')
P = [int(x) for x in P]

prg1 = [i for i, x in enumerate(P) if x <= A]
prg2 = [i for i, x in enumerate(P) if x >= A+1 and x <= B]
prg3 = [i for i, x in enumerate(P) if x >= B+1]

if prg1==0 or prg2==0 or prg3==0:
  result = 0
else:
  result = min([len(prg1),len(prg2),len(prg3)])
print(result)

Solution (Python):


N = int(input())
A, B = list(map(int, input().split()))
P = list(map(int, input().split()))

P.sort()

ans = 0

fir, sec = [], []

for i in range(len(P) - 1):
    if P[i] > A:
        fir = P[:i]
        P = P[i:]
        break


for i in range(len(P)):
    if P[i] > B:
        sec = P[:i]
        P = P[i:]
        break



print(min(len(fir), len(sec), len(P)))

Solution (Python):

 

n = int(input())
tmp=input()
a = int(tmp.split(" ")[0])
b = int(tmp.split(" ")[1])
tmp=input()
p=[int(k) for k in tmp.split()]
p.sort()
x=[0,0,0]

j=int(len(p))
k=0
for k in range(j):
    if p[k]>a:
        break
x[0]=k

p.reverse()
k=0
for k in range(j):
    if p[k]<=b:
        break
x[2]=k
x[1]=j-x[0]-x[2]

print(min(x))

Solution (Python):
def main():
    N = int(input())
    A, B = map(int, input().split())
    P = []
    p = list(map(int, input().split()))
    for l in p:
        P.append(l)
    count = 0
    while True:
        clear = False
        for p in P:
            if 1 <= p <= A:
                P.remove(p)
                clear = True
                break
        if not clear:
            break
        clear = False
        for p in P:
            if A + 1 <= p <= B:
                P.remove(p)
                clear = True
                break
        if not clear:
            break
        clear = False
        for p in P:
            if B + 1 <= p:
                P.remove(p)
                clear = True
                count += 1
                break
        if not clear:
            break
    print(count)


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
A, B = (int(i) for i in input().split())
P = list(map(int, input().split()))
P.sort()
num1 = 0
num2 = 0
num3 = 0
for i in range(len(P)):
    if P[i] <= A:
        num1 = i + 1
    elif P[i] > A and P[i] <= B:
        num2 = i + 1 - num1
    elif P[i] > B:
        num3 = N - num1 - num2
        break
print(min([num1, num2, num3]))

Solution (Python):
N=int(input())
a=[]
a=input().split(" ")
A=int(a[0])
B=int(a[1])
Y=input()
X=[]
X=Y.split(" ") 
Z=[int(i) for i in X] 
Z.sort()
p=[i for i in Z if i<=A]
q=[i for i in Z if A<i<=B]
r=[i for i in Z if B<i]
P=len(p)
Q=len(q)
R=len(r)
print(min(P,Q,R))

Solution (Python):


N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))

f = 0
s = 0
t = 0

for p in P:
    if p <= A:
        f += 1
    elif p <= B:
        s += 1
    else:
        t += 1

print(min(f,s,t))

Solution (Python):
N = int(input())
A, B = list(map(int, input().split()))
P = sorted(list(map(int, input().split())))

from bisect import bisect_right

a = bisect_right(P, A)
b = bisect_right(P, B)
print(min(a, (b - a), N - b))

Solution (Python):
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))

P.sort()
counterA = 0
while P:
    if P[0] <= A:
        counterA += 1
        del P[0]
    else:
        break

counterB = 0
while P:
    if P[0] <= B:
        counterB += 1
        del P[0]
    else:
        break

print(min(counterA, counterB, len(P)))

Solution (Python):
N=int(input())
A,B= map(int, input().split())
P = [int(_) for _ in input().split()]
A_c=B_c=A_B=0
for i in range(N):
    if P[i]<=A: 
        A_c = A_c+1
    elif P[i]>B: 
        B_c = B_c+1
    else:
        A_B = A_B+1
print(min(A_B,A_c,B_c))

Solution (Python):
import math

N=int(input())
A,B=map(int,input().split( ))
P=list(map(int,input().split( )))













PA=[i for i in P if i<=A]
PB=[i for i in P if i>A and i<=B]
PC=[i for i in P if i>B]




m=min(len(PA),len(PB),len(PC))

print(m)

Solution (Python):
N = input()
A,B =input().split()
P = input().split()
ansX = 0
ansY = 0
ansZ = 0
for i in range(int(N)):
    if int(P[i]) <= int(A):
        ansX = ansX+1
    elif int(P[i]) <= int(B):
        ansY = ansY+1
    else:
        ansZ = ansZ+1

ans = ansX
if ans >= ansY:
    ans = ansY
if ans >= ansZ:
    ans = ansZ
print(ans)

Solution (Python):
from sys import stdin
import numpy as np
N=int(stdin.readline().rstrip())
A,B=[int(x) for x in stdin.readline().rstrip().split()]
data=[int(x) for x in stdin.readline().rstrip().split()]
data=np.array(data)
ako=len(data[data<=A])
bko=len(data[data>=B+1])
cko=len(data[data>=A+1])-len(data[data>B])
ans=min([ako,bko,cko])
print(ans)

Solution (Python):
n = int(input())
a, b = [int(x) for x in input().split()]
p = [int(x) for x in input().split()]
c = 0
flag = True

while flag:
    for f in [lambda x: x <= a, lambda x: x > a and x <= b, lambda x: x > b]:
        pt = list(filter(f, p))
        if len(pt) == 0:
            flag = False
            break
        p.remove(min(pt))
    else:
        c += 1

print(c)

Solution (Python):
n = int(input())
a, b = map(int, input().split())
p = [int(i) for i in input().split()]
first = [i for i in p if i<=a]
third = [i for i in p if i>=(b+1)]
first_num = len(first)
third_num = len(third)
second_num = len(p) - first_num - third_num
print(min(first_num, second_num, third_num))

Solution (Python):
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))


def main():
    count1 = len([p for p in P if p <= A])
    count2 = len([p for p in P if p > A and p <= B])
    count3 = len([p for p in P if p > B])

    print(min([count1, count2, count3]))

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
A, B = map(int, input().split())

L = list(map(int, input().split()))


ans = [0, 0, 0]
for i in L:
    if i <= A:
        ans[0] += 1
    elif i >= A + 1 and i <= B:
        ans[1] += 1
    else:
        ans[2] += 1

print(min(ans))

Solution (Python):
N = int(input())
A,B = map(int, input().split())
P = list(map(int, input().split()))
list = [0, 0, 0]
for i in range(N):
	if P[i] <= A:
		list[0] = list[0] + 1
	elif P[i] > A and P[i] <= B:
		list[1] = list[1] + 1
	else:
		list[2] = list[2] + 1
print(min(list))

Solution (Python):
n = int(input())
a, b = map(int, input().split())
p = [int(i) for i in input().split()]

q = [0, 0, 0]
for pi in p:
    if pi <= a:
        q[0] += 1
    elif a+1 <= pi <= b:
        q[1] += 1
    else:
        q[2] += 1

if q[0] != 0 and q[1] != 0 and q[2] != 0:
    print(min(q))
else:
    print(0)

Solution (Python):


N = int(input())
A, B =map(int, input().split())
P = input().split()

q1 = []
q2 = []
q3 = []

for i in P:
    if int(i) <= A:
        q1.append(int(i))
    if int(i) >= A+1 and int(i) <= B:
        q2.append(int(i))
    if int(i) >= B+1:
        q3.append(int(i))

q_len = [len(q1), len(q2), len(q3)]
print(min(q_len))

Solution (Python):
N = int(input())
A,B = list(map(int,input().split()))
P = list(map(int,input().split()))

t1 = sum([p<=A for p in P])
t2 = sum([p>A and p<=B for p in P])
t3 = sum([p>B for p in P])

print(min([t1, t2, t3]))

Solution (Python):
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))

countone = 0
counttwo = 0
countthree = 0

for pi in P:
    if pi > B:
        countthree = countthree + 1
    if (pi <= B)&(pi > A):
        counttwo = counttwo + 1
    if (pi <= A):
        countone = countone + 1

print(min([countone, counttwo, countthree]))

Solution (Python):
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
x = 0
y = 0
z = 0
        
for i in range(n):
  if p[i] <= a:
    x = x + 1
  if a < p[i] <= b:
    y = y + 1
  if b < p[i]:
    z = z + 1

print(min(x, y, z))

Solution (Python):
N = int(input())
A,B= map(int, input().split())

a_list = list(map(int, input().split())) 

test_a=0
test_b=0
test_c=0
for num in a_list:
    if num<= A:
        test_a += 1
    elif A< num<=B:
        test_b += 1
    else:
        test_c += 1
print(min(test_a,test_b,test_c))

Solution (Python):
num_prob = map(int, raw_input().split())
a_b_list = map(int, raw_input().split())
a = a_b_list[0]
b = a_b_list[1]
prob_list = map(int, raw_input().split()) 

num_1 = 0
num_2 = 0
num_3 = 0

for i in range(len(prob_list)):
    if prob_list[i] <= a:
        num_1 += 1
    elif a < prob_list[i] <= b:
        num_2 += 1
    else:
        num_3 += 1

result = min(num_1, num_2, num_3)

print(result)

Solution (Python):
import numpy as np
N = int(input())

A,B = [int(i) for i in input().split()]

a = [int(i) for i in input().split()]

b = 0 
c = 0 
d = 0

for i in range(N):
    if a[i] <= A:
        b = b + 1
    elif a[i] <= B:
        c = c + 1
    else:
        d = d + 1

if b < c:
    if b < d:
        print(b)
    else:
        print(d)
elif c < d:
    print(c)
else:
    print(d)

Solution (Python):
N = int(input())
A, B = list(map(int, input().split()))
P = list(map(int, input().split()))

P.sort()

c1, c2, c3 = 0, 0, 0
for i, p in enumerate(P, 1):
    if p <= A:
        c1 = i
    if (p > A) and (p <= B):
        c2 = i
    if p > B:
        c3 = i


if c1 <= c2 <= c3:
    print(min((c1), (c2 - c1), (c3 - c2)))
else:
    print(0)

Solution (Python):

n = int(input())
a, b = input().strip().split(' ')
a, b = [int(a),int(b)]
arrayP = list(map(int, input().split()))
m = 0
l = 0
s = 0
for i in range(n):
    if arrayP[i] <= a:
        m = m + 1
    elif arrayP[i] > a and arrayP[i] <= b:
        l = l + 1
    else:
        s = s + 1
array = [m,l,s]
array.sort()
print(array[0])

Solution (Python):
N = int(input())
A,B = map(int,input().split())
p = list(map(int,input().split()))
cntA = 0
cntB = 0
cntC = 0

for i in range(N):
    if int(p[i]) <= int(A):
        cntA += 1
    if int(p[i]) >= int(B)+1:
        cntB += 1
    if int(p[i]) >= int(A)+1 and int(p[i]) <= int(B):
        cntC += 1

print(min(cntA,cntB,cntC))

Solution (Python):
n = int(input())
a, b = map(int, input().split())
p_list = list(map(int, input().split()))

len_p_over_a = len([p_i for p_i in p_list if p_i <= a])
len_p_ap1_to_b = len([p_i for p_i in p_list if a+1 <= p_i <= b])
len_p_over_bp1 = len([p_i for p_i in p_list if b+1 <= p_i])

min_combi = min(len_p_over_a, len_p_ap1_to_b, len_p_over_bp1)
print(min_combi)

Solution (Python):
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))

first, second, third = 0, 0, 0
for i in p:
    if i <= a:
        first += 1
    if a+1 <= i <= b:
        second += 1
    if b+1 <= i:
        third += 1

print(min([first, second, third]))

Solution (Python):
N = int(input())
A,B = map(int,input().split())
P = sorted(list(map(int,input().split())))

a,b,c = [],[],[]
for p in P:
    if p<=A: a.append(p)
    elif p<=B: b.append(p)
    else: c.append(p)
    
print(min([len(a),len(b),len(c)]))

Solution (Python):
n = int(input())
a,b = map(int,input().split())
p = list(map(int,input().split()))
c1,c2, c3 = 0,0,0
for i in range(n):
    if p[i] <= a:
        c1 +=1
    elif (a+1) <= p[i] <= b:
        c2 += 1
    elif (b+1) <= p[i]:
        c3 += 1
print(min(c1,c2,c3))

Solution (Python):
n = (int)(input())
A, B = (list)(map(int, input().split()))
scores = (list)(map(int, input().split()))

cand1 = sum(x <= A for x in scores)
cand3 = sum(x >= B+1 for x in scores)
cand2 = n - cand1 - cand3

print(min(cand1, cand2, cand3))

Solution (Python):
n = int(input())
a, b = map(int, input().split())
ans = [0] * 3
for p in map(int, input().split()):
    if p <= a:
        ans[0] += 1
    elif b + 1 <= p:
        ans[2] += 1
    else:
        ans[1] += 1
print(min(ans))

Solution (Python):
N = int(input())
A, B = map(int, input().split())
P = [int(i) for i in input().split()]
r = [0]*3
for p in P:
    if p<=A:
        r[0]+=1
    elif A<p<=B:
        r[1]+=1
    else:
        r[2]+=1
r = sorted(r, reverse=False)
print(r[0])

Solution (Python):
n = int(input())
a, b = map(int, input().split())
p = sorted([int(i) for i in input().split()])

gte_a = len(p)
for i,v in enumerate(p):
    if a + 1 <= v <= b:
        gte_a = i
        break

gte_b = len(p)

for i,v in enumerate(p):
    if b + 1 <= v:
        gte_b = i
        break

s = range(0, gte_a)
t = range(gte_a, gte_b)
u = range(gte_b, len(p))
print(min(map(len, (s,t,u))))

Solution (Python):
N=int(input())
A,B=(int(i) for i in input().split())
point=[int(i) for i in input().split()]
point.sort()
pointp=point[::-1]
p=[i for i in  point if i<=A]
q=[i for i in point if A<i<=B]
r=[i for i in pointp if i>B]
print(min(len(p),len(q),len(r)))

Solution (Python):


N = int(input())
AB = list(map(int, input().split(" ")))
P = list(map(int, input().split(" ")))

Pa = []
Pb = []
Pc = []

for i in range(N):
    Pi = P[i]
    if Pi <= AB[0]:
        Pa.append(Pi)
    elif Pi <= AB[1]:
        Pb.append(Pi)
    else:
        Pc.append(Pi)
        
temp = min(len(Pa),len(Pb))
ans = min(temp,len(Pc))

print(ans)

Solution (Python):
n=int(input())
a,b=map(int,input().split())
p=list(map(int,input().split()))
sita=0
mannaka=0
ue=0
for pi in p:
    if pi <= a:
        sita+=1
    elif a+1 <= pi<=b:
        mannaka+=1
    else:
        ue+=1
print(min(ue,min(sita,mannaka)))

Solution (Python):
N = int(input())
A, B = map(int, input().split())
P = sorted([int(i) for i in input().split()])
ans = 0
num1 = 0
num2 = 0
num3 = 0

for i in P:
    if i <= A:
        num1 += 1
    elif A+1 <= i <= B:
        num2 += 1
    elif B+1 <= i:
        num3 += 1

print(min(num1, num2, num3))

Solution (Python):
n = int(input())
a, b = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]





q_a = 0
q_b = 0
q_c = 0

for i in p:
    if i <= a:
        q_a += 1
    elif a < i <= b:
        q_b += 1
    else:
        q_c += 1

print(min([q_a, q_b, q_c]))

Solution (Python):
n=input()
list1=[int(i) for i in input().split(" ")]
list2=[int(i) for i in input().split(" ")]
a=list1[0]
b=list1[1]
count1=0
count2=0
count3=0
for i in list2:
    if i<=a:
        count1+=1
    elif a<i<=b:
        count2+=1
    else:
        count3+=1
print(min(count1,count2,count3))

Solution (Python):
N = int(input())
A, B = list(map(int, input().split()))
P = list(map(int, input().split()))
E = []
S = []
D = []

for i in range(N):
	if P[i] >= B+1:
		D.append(P[i])
	elif P[i] <= B and P[i] >= A+1:
		S.append(P[i])
	else:
		E.append(P[i])


print(min(len(E), len(S), len(D)))

Solution (Python):
N=int(input())
a,b=map(int,input().split())
list=list(map(int,input().split()))
list1=[]
list2=[]
list3=[]
list.sort()
for i in range(len(list)):
    if list[i]<=a:
        list1.append(list[i])
    elif a+1<=list[i]<=b:
        list2.append(list[i])
    else:
        list3.append(list[i])
print(min(len(list1),len(list2),len(list3)))

Solution (Python):
import numpy as np

n = int(input())
a, b = [int(x) for x in input().split(" ")]

p = np.array([int(x) for x in input().split(" ")])


m1 = np.sum(p <= a)
m2 = np.sum((p > a) & (p <= b))
m3 = np.sum(p > b)

print(np.min([m1, m2, m3]))

Solution (Python):
n = int(raw_input())
a,b = map(int,raw_input().split())
arr = map(int, raw_input().split())
t1 = 0
t2 = 0
t3 = 0
for i in range(n):
    if arr[i] <= a:
        t1 += 1
    elif  a+1<=arr[i]<=b:
        t2 += 1
    else:
        t3 += 1
print min(t1, t2, t3)

Solution (Python):
N = int(input())
A, B = list(map(int, input().split()))
P = list(map(int, input().split()))
P.sort()

count = 0
sel_P_idx = []
for i in range(len(P)-2):
    for j in range(i+1, len(P)-1):
        for k in range(j+1, len(P)):
            if i in sel_P_idx or j in sel_P_idx or k in sel_P_idx:
                continue

            q1 = P[i]
            q2 = P[j]
            q3 = P[k]

            if q1 <= A and A+1 <= q2 <= B and q3 >= B+1:
                count += 1
                sel_P_idx.append(i)
                sel_P_idx.append(j)
                sel_P_idx.append(k)
print(count)

Solution (Python):
n = int(input())
a, b = map(int, input().split())
p_lst = list(map(int, input().split()))
cnt_1 = cnt_2 = cnt_3 = 0
for p in p_lst:
    if p <= a:cnt_1 += 1
    elif p <= b:cnt_2 += 1
    else:cnt_3 += 1
print(min(cnt_1, cnt_2, cnt_3))

Solution (Python):
n=int(input())
a,b=map(int,input().split())
p=input().split()
p=list(map(int,p))
p.sort()
q=filter(lambda x: x<=a,p)
r=filter(lambda x: a+1<=x<=b,p)
s=filter(lambda x:b+1<=x,p)
a=min(len(list(q)),len(list(r)))
print(min(a,len(list(s))))

Solution (Python):
n   = int(input())
a,b = map(int,input().split())
p   = map(int,input().split())
p_  = sorted(p)

anum = bnum = cnum = 0
for i,pi in enumerate(p_):
    if pi > a :
        anum = i
        break

for i,pi in enumerate(p_):
    if pi > b :
        bnum = i - anum
        break

cnum = n - anum - bnum
print(min(anum,bnum,cnum))

Solution (Python):
from itertools import permutations

n  = int(input())
a, b = [int(x) for x in input().split(' ')]
p = sorted([int(x) for x in input().split(' ')])

p_easy = len([x for x in p if x<=a])
p_normal = len([x for x in p if a<x<=b])
p_hard = len([x for x in p if b<x])

print(min(p_easy,p_normal,p_hard))

Solution (Python):
import sys, copy, math, collections, itertools

n = int(input())
a, b = (int(i) for i in input().split())
p = list(map(int, input().split()))

n1 = len([i for i in p if i <= a])
n2 = len([i for i in p if a < i <= b])
n3 = len([i for i in p if b < i])
print(min(n1,n2,n3))

Solution (Python):
n=int(input())
a,b=map(int,input().split())
l=list(map(int,input().split()))
x=y=z=0
for i in l:
  if i<=a:
    x+=1
  elif a+1<=i and i<=b:
    y+=1
  else:
    z+=1
print(min(x,y,z))