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):

import sys
sys.setrecursionlimit(10000)
INF = 1<<32


def solve(N: int, A: int, B: int, P: "List[int]"):
    P.sort()
    from bisect import bisect_left, bisect_right
    x = bisect_right(P, A)
    y = bisect_right(P, B)

    print(min(x, y-x, N-y))

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    A = int(next(tokens))  
    B = int(next(tokens))  
    P = [int(next(tokens)) for _ in range(N)]  
    solve(N, A, B, P)

if __name__ == '__main__':
    main()

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

x = len([0 for i in P if i<=A])
y = len([0 for i in P if i>=A+1 and i<=B])
z = len([0 for i in P if i>=B+1])

print(min(min(x,y),z))

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

q1=len([i for i in range(N) if P[i]<=A])
q2=len([i for i in range(N) if A<P[i]<=B])
q3=len([i for i in range(N) if B<P[i]])

ans=min(q1,q2,q3)
print(ans)

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

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

print(min(C))

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

one = [p for p in pli if p<=a]
two = [p for p in pli if (a+1)<=p<=b]
the = [p for p in pli if (b+1)<=p]

print(min([len(one), len(two), len(the)]))

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

print(ans)

Solution (Python):
n = int(input())
a, b = map(int , input().split())
p = list(map(int, input().split()))
group_a = len([i for i in p if i <= a])
group_b = len([i for i in p if i > a and i <= b])
group_c = len([i for i in p if i > b])
print(min(group_a, group_b, group_c))

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
table = [0] * 3
for p in P:
  if p <= A:
    table[0] += 1
  elif A < p <= B:
    table[1] += 1
  else: 
    table[2] += 1
print(min(table))

Solution (Python):
n=int(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 a+1<=i<=b:
        second+=1
    elif i>=b+1:
        third+=1
co=0
while True:
    if first>0 and second>0 and third>0:
        first-=1
        second-=1
        third-=1
        co+=1
    else:
        break
print(co)

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 += 1
    if a + 1 <= p[i] <= b:
        y += 1
    if b + 1 <= p[i]:
        z += 1

print(min((x, y, z)))

Solution (Python):

import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random

import os
 




 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    A,B = inputMap()
    P = inputList()
    
    rinko = []
    manaka = []
    nene = []
    for i in P:
        if i <= A:
            rinko.append(i)
        elif i >= B+1:
            nene.append(i)
        else:
            manaka.append(i)
            
    print(min(len(rinko), len(nene), len(manaka)))
    
if __name__ == "__main__":
	main()

Solution (Python):
n=int(input())
a,b=map(int,input().split())
p=list(map(int,input().split()))
p1=0
p2=0
p3=0
for x in p:
  if x<=a:
    p1+=1
  elif x<=b:
    p2+=1
  else:
    p3+=1
print(min(p1,p2,p3))

Solution (Python):
from collections import Counter

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

li = []
for i in P:
  if i <= A:
    li.append(1)
  elif A < i <= B:
    li.append(2)
  else:
    li.append(3)
    
cli = Counter(li)

if len(cli.keys()) != 3:
  print(0)
else:
  print(min(cli.values()))

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a,b = inpl()
p = inpl()
d = defaultdict(int)
for i in p:
    if i <= a:
        d[0] += 1
    elif a < i <= b:
        d[1] += 1
    else:
        d[2] += 1
print(min(d[0],d[1],d[2]))

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

print(
    min(
        len(list(filter(lambda x: x <= a, li_p))),
        len(list(filter(lambda x: (a + 1) <= x <= b, li_p))),
        len(list(filter(lambda x: (b + 1) <= x, li_p))),
    )
)

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 p:
  if i <= a:
    c1 += 1
  elif i <= b:
    c2 += 1
  else:
    c3 += 1
print(min(c1, c2, c3))

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

p.sort()

s = 0
t = 0

for i in p:
    if i <= a:
        s += 1
        t += 1
    elif i <= b:
        t += 1

ans = min(s, t-s, len(p)-t)

print(ans)

Solution (Python):


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

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

l=[0,0,0]
for i in p:
    if i<=a:
        l[0]+=1
    elif a+1<=i<=b:
        l[1]+=1
    else:
        l[2]+=1
print(min(l))

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

A, B, C = 0, 0, 0

for i in p:
    if i <= a:
        A += 1
    elif a < i <= b:
        B += 1
    else:
        C += 1

print(min(A, B, C))

Solution (Python):
n = int(input())
a, b = map(int, input().split())
p = [int(i) for i in input().split()]
p_a = len([i for i in p if i <= a])
p_a_b = len([i for i in p if a < i <= b])
p_b = n - p_a - p_a_b
print(min(min(p_a, p_b), p_a_b))

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

q1,q2,q3=0,0,0

for i in range(n):
    if p[i]<=a:
        q1+=1
    elif p[i]<=b:
        q2+=1
    else:
        q3+=1

print(min([q1,q2,q3]))

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

one = 0
two = 0
for p in P:
    if p <= A:
        one += 1
    elif A < p <= B:
        two += 1

print(min(one, two, N - (one + two)))

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

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

p1, p2, p3 = 0, 0, 0
for p in P:
    if p <= a:
        p1 += 1
    elif p <= b:
        p2 += 1
    else:
        p3 += 1

print(min(p1, p2, p3))

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

ans=0
p.sort()
v=0
x=0
z=0
for i in range(len(p)):
    if p[i]<=a:
        v+=1
    elif a<p[i]<=b:
        x+=1
    else:
        z+=1

print(min(v,x,z))

Solution (Python):
N = int(input())
A, B = map(int, input().split())
p = list(map(int, input().split()))
oneCnt = 0
twoCnt = 0
treeCnt = 0
for i in p:
    if i <= A:
        oneCnt += 1
    elif A + 1 <= i <= B:
        twoCnt += 1
    else:
        treeCnt += 1

print(min(oneCnt, twoCnt, treeCnt))

Solution (Python):
n = int(input())
a,b = map(int,input().split())
lis = list(map(int,input().split()))
pro1,pro2,pro3 = 0,0,0
for problem in lis:
  if problem <= a:pro1 += 1
  elif problem <= b:pro2 += 1
  else:pro3 += 1
print(min(pro1,pro2,pro3))

Solution (Python):
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()

Solution (Python):
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
A, B = list(map(int, sys.stdin.readline().split()))
P = list(map(int, sys.stdin.readline().split()))

P = np.array(P, dtype=int)
c1 = (P <= A).sum()
c2 = (B < P).sum()
c3 = N - c1 - c2

print(min(c1, c2, c3))

Solution (Python):
n = int(input())
a, b = map(int, input().split())
p = list(int(x) for x in input().split())
k1, k2, k3 = 0, 0, 0
for i in range(n):
    if p[i] <= a:
        k1 += 1
    elif p[i] <= b:
        k2 += 1
    else:
        k3 += 1
print(min([k1, k2, k3]))

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

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 p:
    if i <= a:
        c1 += 1
    elif a < i <= b:
        c2 += 1
    elif b < i:
        c3 += 1

print(min(c1, c2, c3))

Solution (Python):

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

x1 = 0
x2 = 0
x3 = 0

for i in range(n):
    if p[i] <= a:
        x1 += 1
    elif a < p[i] <= b:
        x2 += 1
    else:
        x3 += 1

print(min(x1, x2, x3))

Solution (Python):
N = int(input())
A, B = tuple(map(int, input().split()))
P = list(map(int, input().split()))
first = [p for p in P if p <= A]
second = [p for p in P if A + 1 <= p <= B]
third = [p for p in P if B + 1 <= p]
print(min(len(first), len(second), len(third)))

Solution (Python):
import sys
def input():
	return sys.stdin.readline().strip()

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

sum_list = [0]*3
for i in range(N):
	if P[i] <= A:
		sum_list[0] += 1
	elif P[i] <= B:
		sum_list[1] += 1
	else:
		sum_list[2] += 1

print(min(sum_list))

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

ans=[0]*3

for i in range(n):
    if l[i]<=a:
        ans[0]+=1
    elif l[i]>b:
        ans[2]+=1
    else:
        ans[1]+=1
print(min(ans))

Solution (Python):
def resolve():
	n=int(input())
	a,b=map(int,input().split())
	p=list(map(int,input().split()))
	l=[0,0,0]
	for i in p:
		if i<=a:
			l[0]+=1
		elif i<=b:
			l[1]+=1
		else:
			l[2]+=1
	print(min(l))
resolve()

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

ans = [0,0,0]
for i in range(n):
    if p[i]<=a:
        ans[0]+=1
    elif p[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()))

C=[0]*3
for p in P:
  if p<=A:
    C[0]+=1
  elif A+1<=p<=B:
    C[1]+=1
  else:
    C[2]+=1
    
print(min(C))

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

for i in p:
    if i<=a:
        x += 1
    elif i>=b+1:
        z += 1
    else:
        y += 1

print(min(x, y, z))

Solution (Python):
n=int(input())
a,b=map(int, input().split())
l=list(map(int, input().split()))
ul=[]
ml=[]
ol=[]
sorted(l)
for i in range(n):
	if l[i]<=a:
		ul.append(l[i])
	elif (a+1)<=l[i]<=b:
		ml.append(l[i])
	elif l[i]>=(b+1):
		ol.append(l[i])
print(min(len(ul),len(ml),len(ol)))

Solution (Python):
def main():

    N = int(input())
    A, B = map(int, input().split())
    P = list(map(int, input().split()))
    count = [0, 0, 0]
    for p in P:
        if p <= A:
            count[0] += 1
        elif A < p <= B:
            count[1] += 1
        else:
            count[2] += 1
    return min(count)

if __name__ == '__main__':
    print(main())

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

for i in p:
    if i <= A:
        No1 += 1
    elif i >= A and i <= B:
        No2 += 1
    else:
        No3 += 1

print(min(No1,No2,No3))

Solution (Python):
def solve(n, a, b, p):
    v = [0] * 3
    for i in range(n):
        if p[i] <= a:
            v[0] += 1
        elif p[i] <= b:
            v[1] += 1
        else:
            v[2] += 1
    return min(v)

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

Solution (Python):
N = int(input())
A, B = map(int, input().split())
Ps = list(map(int, input().split()))
n1 = 0
n2 = 0
n3 = 0
for P in Ps:
  if P <= A:
    n1 += 1
  if A+1 <= P <= B:
    n2 += 1
  if P >= B+1:
    n3 += 1
r = min(n1, n2, n3)
print(r)

Solution (Python):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): 
    return list(map(int,input().split()))
def m(): 
    return map(int,input().split())
def onem(): 
    return int(input())
def s(x): 
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): 
    return " ".join(map(str,x))
def max2(x): 
    return max(map(max,x))
def In(x,a): 
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n = onem()

a,b = m()

p = l()
c = 0
co = 0
coo = 0

for i in range(n):
    if p[i] <= a:
        c += 1
    elif p[i] <= b:
        co += 1
    else:
        coo += 1
print(min(c,co,coo))

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

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

first=[i for i in p if i <= a]
second=[i for i in p if i <= b and i >= a+1]
third=[i for i in p if i >=b+1]

print(min(len(first), len(second), len(third)))

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

q_1 = []
q_2 = []
q_3 = []

for i in P:
    if i <= A:
        q_1.append(i)
    elif A < i <= B:
        q_2.append(i)
    else:
        q_3.append(i)

print(min(len(q_1), len(q_2), len(q_3)))

Solution (Python):
N,A,B,*P=map(int,open(0).read().split());b=len([p for p in P if p>A]);c=len([p for p in P if p>B]);print(min(N-b,b-c,c))

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

a = len([p for p in P if p<=A])
a = min(a,
        len([p for p in P if A<p<=B]))
a = min(a,
        len([p for p in P if B<p]))
print(a)

Solution (Python):
import numpy as np
n = int(input())
a,b = map(int, input().split())
p = np.array([int(i) for i in input().split()])
x1 = len(p[p <= a])
x2 = len(p[(a+1 <= p) & (p <= b)])
x3 = len(p[p>= b+1])
print(min(x1,x2,x3))

Solution (Python):
N=int(input())
AB=input().split()
AB=[int(n) for n in AB]
P=input().split()
P=[int(n) for n in P]
q=[0,0,0]

for p in P:
  if (p<=AB[0]):
    q[0]+=1
  elif (AB[0]+1)<=p<=(AB[1]):
    q[1]+=1
  elif (AB[1]+1)<=p:
    q[2]+=1

print ('{}'.format(min(q)))

Solution (Python):
n = int(input())
a, b = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
key1 = 0
key2 = n-1
for i in range(n):
    if p[i] > a:
        key1 = i-1
        break
for i in range(key1+1,n):
    if p[i] > b:
        key2 = i-1
        break
print(min(key1+1,key2-key1,len(p)-1-key2))

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

c0 = 0
c1 = 0
c2 = 0

for i in range(N):
    if P[i] <= A:
        c0 += 1
    elif A + 1 <= P[i] <= B:
        c1 += 1
    else:
        c2 += 1

print(min(c0, c1, c2))

Solution (Python):
n = int(input())
a, b = map(int, input().split())
P = list(map(int, input().split()))
p1 = len(list(filter(lambda x: x <= a, P)))
p2 = len(list(filter(lambda x: a+1 <= x <= b, P)))
p3 = len(list(filter(lambda x: x >= b+1, P)))
print(min(p1, p2, p3))

Solution (Python):
n=int(input())
a,b=map(int,input().split())
p=list(map(int,input().split()))
ca=0
cb=0
cc=0
for i in range(n):
    if p[i]<=a:
        ca+=1
    elif a<p[i] and p[i]<=b:
        cb+=1
    else:
        cc+=1
print(min(ca,cb,cc))

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

X = [0,0,0]
for p in P:
    if p <= A:
        X[0] += 1
    elif p <= B:
        X[1] += 1
    else:
        X[2] += 1

print(min(X))

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

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

for i in range(n):
    if p[i] <= a:
        count1 +=1
    elif a+1 <= p[i] <= b:
        count2 +=1
    elif b+1 <= p[i]:
        count3 +=1
print(min(count1,count2,count3))

Solution (Python):
N=int(input())
A,B=map(int,input().split())
P=list(map(int,input().split()))
x=0
y=0
z=0
for p in P:
  if p<=A:
    x+=1
  elif A+1<=p and p<=B:
    y+=1
  else:
    z+=1
print(min(x,y,z))

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

cntx = 0
cnty = 0
cntz = 0

for i in range(n):
  if numlist[i]<=a:
    cntx += 1
  elif numlist[i]<=b:
    cnty += 1
  else:
    cntz += 1
 
print(min([cntx, cnty, cntz]))

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

Solution (Python):
A=input()
A,B=input().split()
A=int(A)
B=int(B)
P=input().split()
c=[0]*3
for i in P:
        i=int (i)
        if i <= A:
                c[0]+=1
        elif i <= B:
                c[1]+=1
        else :
                c[2]+=1
c.sort()
print(c[0])

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

one = len([i for i in score if i <= a])
two = len([i for i in score if (a < i <= b)])
three = n - one - two
print(min((one, two, three)))

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 += 1
    elif p[i] <= b:
        y += 1
    else:
        z += 1
print(min(x, y, z))

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

Solution (Python):


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

p.sort()

cnt = [0,0,0]

for i in range(0,n):
    if(p[i] <= a):
        cnt[0]+=1
    elif(a < p[i] <= b):
        cnt[1]+=1
    else:
        cnt[2]+=1


print(min(cnt))

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

for i in range(len(P)):
	if P[i] <= A:
		A_list.append(P[i])
	elif A+1<=P[i] and P[i] <= B:
		B_list.append(P[i])
	else:
		C_list.append(P[i])
		
print(min(len(A_list),len(B_list),len(C_list)))

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

P.sort()
d = {
    "A":0,
    "B":0,
    "C":0,
}
for p in P:
    if p <= A:
        d["A"] += 1
    elif p <= B:
        d["B"] += 1
    else:
        d["C"] += 1

print(min(d["A"],d["B"],d["C"]))

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

p1 = 0; p2 = 0; p3 = 0
for item in p:
    if item <= a:
        p1 += 1
    elif item <= b:
        p2 += 1
    else:
        p3 += 1
print(min(p1, p2, p3))

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

count = [0, 0, 0]
for p in P:
	if p <= A:
		count[0] += 1
	elif p <= B:
		count[1] += 1
	else:
		count[2] += 1
print(min(count))

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

print(min(len([p for p in P if p<=A]), \
len([p for p in P if A+1<=p<=B]), \
len([p for p in P if B+1<=p])))

Solution (Python):
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
c = [0, 0, 0]
for pt in p:
    if pt > b:
        c[2] += 1
    elif pt > a:
        c[1] += 1
    else:
        c[0] += 1
print(min(c))

Solution (Python):

def main():
    n = int(input())
    A, B = list(map(int, input().rstrip().split()))
    P = sorted(map(int, input().rstrip().split()))
    a, b, c = 0, 0, 0
    for i in P:
        if i <= A:
            a += 1
        elif A < i <= B:
            b += 1
        else:
            c += 1
    print(min(a, b, c))


if __name__ == "__main__":
    main()

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

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

Q1 = len([x for x in P if x <= A])
Q2 = len([x for x in P if A+1 <= x <= B])
Q3 = len([x for x in P if x >= B+1])

print(min(Q1, Q2, Q3))

Solution (Python):
import bisect

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

P.sort()

a = bisect.bisect_right(P, A)
b = bisect.bisect_right(P, B)

print(min(a, b - a, N - b))

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


alist=[]
blist=[]
clist=[]
for p in plist:
  if p<=A:
    alist.append(p)
  elif p<=B:
    blist.append(p)
  else:
    clist.append(p)
    
print(min(len(alist),len(blist),len(clist)))

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

memo = [0]*3
for e in P:
    if e <= A:
        memo[0] += 1
    elif e <= B:
        memo[1] += 1
    else:
        memo[2] += 1
print(min(memo))

Solution (Python):
n = int(input())
a, b = [ int(v) for v in input().split() ]
num_list = [ int(v) for v in input().split() ]
x, y, z = 0, 0, 0
for i in num_list:
  if i <= a:
    x += 1
  elif i <= b:
    y += 1
  else:
    z += 1
print(min(x,y,z))

Solution (Python):
n = int(input())
a, b = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
cnt = [0,0,0]
for i in range(n):
    if p[i] <= a:
        cnt[0] += 1
    elif p[i] >= b+1:
        cnt[2] += 1
    else:
        cnt[1] += 1

print(min(cnt))

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

n1 = sum(1 if x <= A else 0 for x in P)
n2 = sum(1 if A < x <= B else 0 for x in P)
n3 = sum(1 if B < x else 0 for x in P)
answer = min(n1,n2,n3)
print(answer)

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

first = []
second = []
third = []
for p in P:
    if p in range(A+1):
        first.append(p)
    elif p in range(A+1, B+1):
        second.append(p)
    else:
        third.append(p)
print(min(len(first), len(second), len(third)))

Solution (Python):
n=int(input())
a,b=map(int,input().split())
p=[int(i) for i in input().split()]
x=sum(i<=a for i in p)
y=sum(a<i<=b for i in p)
z=sum(b<i for i in p)
print(min(x,y,z))

Solution (Python):
n = int(input())
a,b = map(int,input().split())
ps = list(map(int,input().split()))
minn = []
middle = []
max = []
for p in ps:
    if p<=a:
        minn.append(p)
    elif a<p and p<=b:
        middle.append(p)
    else:
        max.append(p)
print(min(len(minn),len(middle),len(max)))

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

Solution (Python):

import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())


N = int(input())
A, B = mi()
Ps = list(mi())

acnt = 0
bcnt = 0
ccnt = 0

for p in Ps:
  if p <= A: acnt += 1
  elif p <= B: bcnt += 1
  else: ccnt += 1

print(min(acnt,bcnt,ccnt))

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

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

p.sort()

p1 = [i for i in p if i<=a]
p2 = [j for j in p if a<j<=b]
p3 = [k for k in p if b<k]

print(min([len(p1),len(p2),len(p3)]))

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


First, Second, Third = [], [], []
for p in P:
	if p <= A:
		First.append(p)
	elif p >= B + 1:
		Third.append(p)
	elif p >= A + 1:
		Second.append(p)

print(min(len(First), len(Second), len(Third)))

Solution (Python):
import bisect
n=int(input())
a,b=map(int,input().split())
p=sorted(list(map(int,input().split())))
s1=bisect.bisect_right(p,a)
s2=bisect.bisect_right(p,b)
print(min(s1,s2-s1,n-s2))

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

Solution (Python):
N=int(input())
A,B=map(int,input().split())
T=list(map(int,input().split()))
print(min(len([t for t in T if t<=A]),len([t for t in T if A<t<=B]),len([t for t in T if B<t])))

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

Solution (Python):
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
ans = [0] * 21

for i in range(N):
  ans[P[i]] += 1

print(min(sum(ans[0:A + 1]), sum(ans[A + 1:B + 1]), sum(ans[B + 1:])))

Solution (Python):
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
ans = [0] * 21

for i in range(N):
  ans[P[i]] += 1

print(min(sum(ans[0:A + 1]), sum(ans[A + 1:B + 1]), sum(ans[B + 1:])))

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

Solution (Python):
n = int(input())
a,b = map(int,input().split())
P = list(map(int,input().split()))
s = []
m = []
l = []
for p in P:
    if p <= a:
        s.append(p)
    elif p <= b:
        m.append(p)
    else:
        l.append(p)
print(min(len(s),len(m),len(l)))

Solution (Python):
if __name__=="__main__":
    n = int(input())
    A, B = [int(i) for i in input().split(' ')]
    C = [int(i) for i in input().split(' ')]
    l = 0
    mid = 0
    r = 0
    for i in C:
        if i <= A:
            l += 1
        elif i <= B:
            mid += 1
        else:
            r += 1
    print(min(l, min(mid, r)))

Solution (Python):
n=int(input())
a,b=map(int,input().split())
arr=list(map(int,input().split()))
arr=sorted(arr)
pos1=0
pos2=0
for i in range(n):
  if arr[i]<=a:
    pos1=i+1
  if arr[i]<=b:
    pos2=i+1
ans=min(pos1,pos2-pos1,n-pos2)
print(ans)

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

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

n1 = len([x for x in Ps if x <= A])
n2 = len([x for x in Ps if A < x <= B])
n3 = len([x for x in Ps if B + 1 <= x])
ans = min(n1, n2, n3)

print(ans)

Solution (Python):
n = int(input())
a,b = map(int,input().split())
l = 0
m = 0
u = 0
x = list(map(int,input().split()))
for i in range(n):
    if x[i]<=a:
        l+=1
    elif x[i]<=b:
        m+=1
    else:
        u += 1

print(min(l,m,u))

Solution (Python):
n=int(input())
a,b=map(int,input().split())
p1,p2,p3=0,0,0
for t in map(int,input().split()):
  if t<=a:
    p1+=1
  elif t<=b:
    p2+=1
  else:
    p3+=1
print(min(p1,p2,p3))

Solution (Python):
import bisect
n=int(input())
a,b=[int(i) for i in input().split()]
p=sorted([int(i) for i in input().split()])
print(min(bisect.bisect_right(p,a),bisect.bisect_right(p,b)-bisect.bisect_right(p,a),n-bisect.bisect_right(p,b)))