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):
input()
a,b=map(int,input().split())
p=list(map(int,input().split()))
x=0
y=0
z=0
for i in p:
  if b<i:
    x+=1
  elif a<i:
    y+=1
  else:
    z+=1
print(min(x,y,z))

Solution (Python):
n=int(input())
a,b=map(int, input().split())
*p,=map(int, input().split())
mn,md,mx=0,0,0
for pi in p:
    if pi<=a:
        mn+=1
    elif pi<=b:
        md+=1
    else:
        mx+=1
print(min(mn,md,mx))

Solution (Python):
pxcount=0
pycount=0
pzcount=0

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

for i in p:
  if i<=a:
    pxcount=pxcount+1
for i in p:
  if a+1<=i and i<=b:
    pycount=pycount+1
for i in p:
  if b+1<=i:
    pzcount=pzcount+1
  
print(min(pxcount,pycount,pzcount))

Solution (Python):
n = int(input())
a,b = map(int,input().split())
p = list(map(int,input().split()))
f = 0
s = 0
t = 0
for i in p:
  if i <= a:
    f += 1
  elif i <= b:
    s += 1
  else:
    t += 1
print(min(f,s,t))

Solution (Python):
from sys import stdin
rs = lambda : stdin.readline().strip()
ri = lambda : int(rs())
ril = lambda : list(map(int, rs().split()))

def main():
    N = int(input())
    A, B = ril()
    P = ril()
    a, b, c = 0, 0, 0
    for p in P:
        if p <= A:
            a += 1
        elif p <= 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())
c = map(int,input().split())
lis1 = []
lis2 = []
lis3 = []
for i in c:
    if i <= a:
        lis1.append(i)
    if a+1 <= i <= b:
        lis2.append(i)
    if b+1 <= i:
        lis3.append(i)
print(min(len(lis1),len(lis2),len(lis3)))

Solution (Python):
N = int(input())
A,B = map(int,input().split())
P = list(map(int, input().split()))
m1 = []
m2 = []
m3 = []
for i in range(N):
    if P[i] <= A:
        m1.append(i)
    elif A+1 <= P[i] <= B:
        m2.append(i)
    elif B+1 <= P[i]:
        m3.append(i)
print(min(len(m1),len(m2),len(m3)))

Solution (Python):
n=int(input())
a,b=map(int,input().split())
P=list(map(int,input().split()))
q,w,e=0,0,0
for i in P:
    if i<=a:
        q+=1
    elif i<=b:
        w+=1
    else:
        e+=1
print(min(q,w,e))

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

Solution (Python):
N = int(input())
A,B=map(int,input().split())
P_s = list(map(int,input().split()))
CNT_s = [0]*3
for P in P_s:
    if P <= A:
        CNT_s[0] += 1
    elif A <  P <= B:
        CNT_s[1] += 1
    if B <  P:
        CNT_s[2] += 1
print(min(CNT_s))

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 p[i] <= b: cnt[1] += 1
  else: cnt[2] += 1
ans = min(cnt)
print(ans)

Solution (Python):
N=int(input())
A,B=map(int,input().split())
p = list(map(int,input().split()))
c=[]
d=[]
e=[]
for i in range(N):
    if p[i]<=A:
        c.append(p[i])
    if A+1 <= p[i] <= B:
        d.append(p[i])
    if B+1 <= p[i]:
        e.append(p[i])

        
print(min(len(c),len(d),len(e)))

Solution (Python):
n = int(input())
a,b = map(int,input().split())
x,y,z = 0,0,0
li = list(map(int,input().split()))
for i in range(n):
    if li[i] <= a:
        x += 1
    elif li[i] >= a + 1 and li[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()))
c=[]
d=[]
e=[]
for i in range(N):
    if p[i]<=A:
        c.append(p[i])
    if A+1 <= p[i] <= B:
        d.append(p[i])
    if B+1 <= p[i]:
        e.append(p[i])

        
print(min(len(c),len(d),len(e)))

Solution (Python):
import math
import statistics
a=int(input())




e1,e2 = map(int,input().split())
f = list(map(int,input().split()))




a1=[]
b1=[]
c1=[]
for i in range(a):
    if f[i]<=e1:
        a1.append(f[i])
    if e1<f[i]<=e2:
        b1.append(f[i])
    if e2<f[i]:
        c1.append(f[i])

lis = [len(a1),len(b1),len(c1)]
print(min(lis))

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

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

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

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

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

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

for i in p:
  if i <= a:
    a1 += 1
  elif a+1 <= i and i <= b:
    a2 += 1
  else:
    a3 += 1

print(min(a1,a2,a3))

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

count=[0]*3
for i in range(N):
  if P[i]<=A:
    count[0] += 1
  if A<P[i]<=B:
    count[1] += 1
  if B<P[i]:
    count[2] += 1
    
print(min(count))

Solution (Python):
n = int(input())
a,b = map(int,input().split())
p = list(map(int,input().split()))
ans = [0]*3

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[0],ans[1],ans[2]))

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    A, B = map(int, readline().split())
    P = list(map(int, readline().split()))

    cnt = [0] * 3

    for x in P:
        if x <= A:
            cnt[0] += 1
        elif x <= B:
            cnt[1] += 1
        else:
            cnt[2] += 1

    print(min(cnt))


if __name__ == '__main__':
    main()

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

q_a = []
q_b = []
q_c = []

for p in P:
    if p <= A:
        q_a.append(p)
    elif p <= B:
        q_b.append(p)
    else:
        q_c.append(p)

ans = 0
while q_a:
    q_a.pop()
    if q_b:
        q_b.pop()
    else:
        break
    if q_c:
        q_c.pop()
    else:
        break
    ans += 1
print(ans)

Solution (Python):
def main():
    n = int(input())
    a, b = map(int, input().split())
    p_list = list(map(int, input().split()))
    diff_list = [0] * 3

    for p in p_list:
        if p <= a:
            diff_list[0] += 1
        elif a + 1 <= p <= b:
            diff_list[1] += 1
        else:
            diff_list[2] += 1

    print(min(diff_list))


if __name__ == "__main__":
    main()

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

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

x,y,z=0,0,0
for i in l:
    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 = [int(x) for x in input().split()]

aa, ab, bb = [], [], []

for x in l:
  if x <= a:
    aa.append(x)
  elif a + 1 <= x and x <= b:
    ab.append(x)
  else:
    bb.append(x)

print(min(map(len, [aa, ab, bb])))

Solution (Python):
from itertools import combinations
N=int(input())
A,B=map(int,input().split())
P=list(map(int,input().split()))
arr=[0]*3

for i in range(N):
    if P[i]<=A:
        arr[0]+=1
    elif P[i]<=B:
        arr[1]+=1
    else:
        arr[2]+=1
print(min(arr))

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

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

cnt = [0] * 3
for pi in p:
    if(pi <= a):
        cnt[0] += 1
    elif(pi > b):
        cnt[2] += 1
    else:
        cnt[1] += 1

print(min(cnt))

Solution (Python):
n = int(input())
A,B = map(int,input().split())
p = list(map(int,input().split()))
a1 = 0
for i in range(A+1):
    a1 += p.count(i)
a2 = 0
for i in range(A+1,B+1):
    a2 += p.count(i)
a3 = 0
for i in range(B+1,21):
    a3 += p.count(i)

print(min(a1,a2,a3))

Solution (Python):
N=int(input())
A,B=map(int,input().split())
P=list(map(int,input().split()))
listA=[]
listB=[]
listC=[]
for i in P:
    if i<=A:
        listA.append(i)
    elif A+1<=i<=B:
        listB.append(i)
    else:
        listC.append(i)
print(min(len(listA),len(listB),len(listC)))

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

lis = sorted(lis, reverse=True)

cnt = 0
for i in range(n):
    tmp = []
    for j in lis:
        if j >= b+1:
            tmp.append(j)
            break
    for k in lis:
        if a+1 <= k <= b:
            tmp.append(k)
            break
    
    for l in lis:
        if l <= a:
            tmp.append(l)
            break
    
    if len(tmp) == 3:
        cnt += 1
    
    for x in tmp:
        lis.remove(x)

print(cnt)

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
    elif a + 1 <= 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 = [int(x) for x in input().split()]
A=0
B=0
C=0
for i in range(n):
    if p[i] <= a:
        A += 1
    elif p[i] > a and b >= p[i]:
        B += 1
    else:
        C += 1

print(min(A, B, C))

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    A, B = LI()
    P = LI()

    ans = [0] * 3
    for i in P:
        if i <= A:
            ans[0] += 1
        elif A + 1 <= i <= B:
            ans[1] += 1
        else:
            ans[2] += 1

    print(min(ans))

if __name__ == '__main__':
    resolve()

Solution (Python):
n=int(input())
a,b,=map(int,input().split())
p=sorted(list(map(int,input().split())))
print(min(sum(i<=a for i in p),sum(a<i and i<=b for i in p),sum(b<i for i in p)))

Solution (Python):
import itertools

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

cnt = 0
first = []
second = []
third = []
for i in points:
    if i <= a:
        first.append(i)
    elif a+1 <= i and i <= b:
        second.append(i)
    else:
        third.append(i)

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

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

Solution (Python):
n,a,b,*p,=map(int,open(0).read().split())
A,B,C=0,0,0
for i in p:
    if i<=a:
        A+=1
    elif i<=b:
        B+=1
    else:
        C+=1
print(min(A,B,C))

Solution (Python):
N = int(input())
A,B = map(int,input().split())
NNN = map(int,input().split())
NN= list(NNN)
counta = 0
countb = 0
countc = 0
for i in NN:
  if i <= A:
    counta += 1
for i in NN:
  
  if A < i <= B:
    countb += 1
for i in NN:
  if B < i:
    countc += 1


print(min(counta,countb,countc))

Solution (Python):
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

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


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
easy = []
norm = []
hard = []
for pi in p:
    if pi <= a:
        easy.append(pi)
    elif a < pi <= b:
        norm.append(pi)
    else:
        hard.append(pi)

ans = min(len(easy), len(norm))
ans = min(ans, len(hard))
print(ans)

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

q = {0:0, 1:0, 2:0}
for i in p:
    if i <= a:
        q[0] += 1
    elif i >= b + 1:
        q[2] += 1
    else:
        q[1] += 1
print(min(q.values()))

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

cnt = [0]*3

for pp in p:
    if pp <= a: cnt[0] += 1
    elif pp <= 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()))

fst, snd, thr = 0, 0, 0

for p in P:
    if p <= a:
        fst += 1
    elif a + 1 <= p <= b:
        snd += 1
    else:
        thr += 1

print(min([fst, snd, thr]))

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

Solution (Python):
N=int(input())
A,B=map(int,input().split())
P=list(map(int,input().split()))
count=[0]*3
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):
N = int(input())
A,B = map(int, input().split())
*P, = map(int, input().split())

P.sort()

c = [0] * 3
for p in P:
    if p <= A:
        c[0] += 1
    elif A < p <= B:
        c[1] += 1
    elif B < p:
        c[2] += 1

print(min(c))

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>A and x<=B 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()))
count =[0,0,0]

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

min = 100    
for i in count:
  if min > i:
    min = i
print(min)

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

Solution (Python):
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
a = len([*filter(lambda x: x<=A,P)])
b = len([*filter(lambda x: A<x<=B,P)])
c = len([*filter(lambda x: B<x,P)])
print(min(a,b,c))

Solution (Python):
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=int(input())
a,b=mp()
p=lmp()
ans=[0,0,0]
for i in p:
    if i<=a:
        ans[0]+=1
    elif i<=b:
        ans[1]+=1
    else:
        ans[2]+=1
print(min(ans))

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

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

for pi in p:
    if pi<=A:
        c1 += 1
    elif A<pi<=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()))
c, d, e = 0, 0, 0
for pp in p:
    if pp <= a:
        c += 1
    elif pp <= b:
        d += 1
    else:
        e += 1
print(min(c, d, e))

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

Solution (Python):
import math
import sys
import collections
import bisect


def main():
    n = int(input())
    a, b = map(int, input().split())
    p = list(map(int, input().split()))
    q = [0, 0, 0]
    for i in range(n):
        if p[i] <= a:
            q[0] += 1
            continue
        if p[i] <= b:
            q[1] += 1
            continue
        q[2] += 1
    print(min(q))


if __name__ == '__main__':
    main()

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

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    A, B = map(int, readline().split())
    P = list(map(int, readline().split()))
    a = 0
    b = 0
    c = 0
    for p in P:
        if p<=A:
            a += 1
        elif A<p<=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()))
small = 0
medium = 0
large = 0
for score in p:
    if score <= a:
        small += 1
    elif a < score <= b:
        medium += 1
    elif score > b:
        large += 1
ans = min(small, medium, large)
print(ans)

Solution (Python):
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
dp = [0]*3

for i in p:
    if i <= a:
        dp[0] += 1
    elif a < i <= b:
        dp[1] += 1
    else:
        dp[2] += 1

print(min(dp))

Solution (Python):
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
p1 = []
p2 = []
p3 = []

for i in p:
    if i <= a:
        p1.append(i)
    elif a < i <= b:
        p2.append(i)
    else:
        p3.append(i)

ans = min(len(p1), len(p2), len(p3))
print(ans)

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

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

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

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


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

print(min(q1, q2, q3))

Solution (Python):
input()
a, b = map(int, input().split())
s = t = u = 0
for p in map(int, input().split()):
  if p <= a:
    s += 1
  elif p <= b:
    t += 1
  else:
    u += 1
print(min(s, t, u))

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

cnt = {0:0, 1:0, 2:0}

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

print(min(cnt.values()))

Solution (Python):
N = int(input())
A, B = map(int,input().split())
P = list(map(int,input().split()))
prob1 = 0
prob2  =0
prob3 = 0
for i in P: 
  if i <= A: prob1 += 1
  elif B + 1 <= i: prob3 += 1
  else: prob2 += 1
print(min(prob1,prob2,prob3))

Solution (Python):
import sys, math
from functools import lru_cache
from collections import deque
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N = ii()
    A, B = mi()
    P = list(mi())
    diff_a = sum(1 for p in P if p <= A)
    diff_b = sum(1 for p in P if A < p <= B)
    diff_c = sum(1 for p in P if p > B)
    print(min(diff_a, diff_b, diff_c))


if __name__ == '__main__':
    main()

Solution (Python):


N = int(input())

a, b = map(int,input().split())
P = list(map(int,input().split()))
ans = 0
c1 = 0
c2 = 0
c3 = 0

for p in P:
    if p <= a:
        c1 += 1
    elif a < p <= b:
        c2 += 1
    else:
        c3 += 1
print(min(c1,c2,c3))

Solution (Python):
N = int(input())
A, B = map(int, input().split())
first = 0
second = 0
third = 0
for P in input().split():
    P = int(P)
    if P <= A:
        first += 1
    elif P <= B:
        second += 1
    else:
        third += 1
print(min(first, second, third))

Solution (Python):
n=int(input())
a,b=map(int,input().split())
p=list(map(int,input().split()))
e,m,d=0,0,0
for x in p:
    if x<=a:e+=1
    if a<x<=b:m+=1
    if b<x:d+=1
print(min(e,m,d))

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 A + 1 <= 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()))

c, d, e = [],[],[]

for i in range(n):
  if p[i] <= a:
    c.append(p[i])
  elif p[i] <= b:
    d.append(p[i])
  else:
    e.append(p[i])
print (min(len(c),len(d),len(e)))

Solution (Python):


import sys
from typing import Any, Callable, Deque, Dict, List, Mapping, Optional, Sequence, Set, Tuple, TypeVar, Union































def main():
    Num = Union[int, float]
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input():  return sys.stdin.readline().rstrip()
    def ii():     return int(input())
    def isp():    return input().split()
    def mi():     return map(int, input().split())
    def mi_0():   return map(lambda x: int(x)-1, input().split())
    def lmi():    return list(map(int, input().split()))
    def lmi_0():  return list(map(lambda x: int(x)-1, input().split()))
    def li():     return list(input())
    def debug(x): print(x, file=sys.stderr)
    
    
    
    n = ii()
    a, b = mi()
    L = lmi()
    x, y, z = 0, 0, 0
    for num in L:
        if num <= a:
            x += 1
        elif num <= b:
            y += 1
        else:
            z += 1
    print(min(x, y, z))


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
cnt1 = 0
cnt2 = 0
cnt3 = 0
for i in p:
    if i <= a:
        cnt1 += 1
    elif i <= b:
        cnt2 += 1
    else:
        cnt3 += 1
ans = min(cnt1, cnt2, cnt3)
print(ans)

Solution (Python):
from bisect import bisect_right
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
p.sort()

idx_a = bisect_right(p, a)
idx_b = bisect_right(p, b)

ans = min(idx_a, idx_b - idx_a, n - idx_b)
print(ans)

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 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()))
n1 = 0
n2 = 0
n3 = 0
for i in P:
  if i <= A:
    n1 += 1
  elif i <= B:
    n2 += 1
  else:
    n3 += 1
print(min(min(n1,n2),n3))

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

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

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

print(min(problem))

Solution (Python):
N = int(input())
A,B = map(int,input().split())
P = list(map(int,input().split()))
P.sort()
count1,count2,count3 = 0,0,0
for i in range(N):
  if P[i] <= A:
    count1 += 1
  if P[i] >= B+1:
    count3 += 1
    continue
  if P[i] >= A+1:
    count2 += 1
print(min(count1,count2,count3))

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

cnt1=0
cnt2=0
cnt3=0
for i in range(n):
    if p[i]<=a:
        cnt1+=1
    elif a<p[i]<=b:
        cnt2+=1
    else:
        cnt3+=1
print(min([cnt1,cnt2,cnt3]))

Solution (Python):
import sys
N=int(input())
A,B=map(int,input().split())
P=list(map(int,input().split()))
a=0
b=0
c=0
for x in range(N):
  if P[x]<=A:
    a+=1
  elif P[x]>A and P[x]<=B:
    b+=1
  elif P[x]>B:
    c+=1
  else:
    sys.stderr.write("error")
print(min(a,b,c))

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

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

Q = [0]*3
for i in range(n):
  if P[i] <= a:
    Q[0] += 1
  elif P[i] <= b:
    Q[1] += 1
  else:
    Q[2] += 1
    
print(min(Q))

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 a + 1 <= p[i] and 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()))
a, b, c = 0, 0, 0
for i in p:
    if i <= A: a += 1
    elif 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()))
q1,q2,q3 = 0,0,0

for x in P:
	if x<=A:
		q1 += 1
	elif x<=B:
		q2 += 1
	else:
		q3 += 1

print(min(q1,q2,q3))

Solution (Python):
N=int(input())
x,y = map(int,input().split())
p = list(map(int,input().split()))

a=0
b=0
c=0

for i in range(N):
  if p[i]<=x:
    a+=1
  elif p[i]>=y+1:
    c+=1
  else:
    b+=1

print(min([a,b,c]))

Solution (Python):
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())
a,b=nii()
p=lnii()

x=0
y=0
z=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):

from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement


n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
k=0
l=0
m=0
for x in p:
    if x<=a: k+=1
    elif x>=a+1 and x<=b: l+=1
    elif x>=b+1: m+=1
print(min(k, l, m))

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

Solution (Python):
N=int(input())
A,B=map(int,input().split())
P=list(map(int,input().split()))
a=0
b=0
c=0
for num in P:
    if num<=A:
        a+=1
    elif A<num<=B:
        b+=1
    else:
        c+=1

print(min(a,b,c))

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

    cnt = [0]*3
    for p in P:
        if p <= A:
            cnt[0] += 1
        elif p <= B:
            cnt[1] += 1
        else:
            cnt[2] += 1

    print(min(cnt))


if __name__ == '__main__':
    main()