N, M, X = list(map(int, input().split()))

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



A.sort()

L = 0

R = 0

for a in A:

    if a < X:

        L += 1

    else:

        R += 1



print((min(L, R)))

N, M, X = list(map(int, input().split()))

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

left = 0

right = 0

for i in A:

    if i < X:

        left += 1

    else:

        right += 1



print((min(left, right)))

N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
L = 0
R = 0
for a in A:
    if a < X:
        L += 1
    else:
        R += 1
print((min(L, R)))

N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
left = 0
right = 0
for i in A:
    if i < X:
        left += 1
    else:
        right += 1
print((min(left, right)))

-A.sort() -L = 0 -R = 0 -for a in A: -    if a < X: -        L += 1 +left = 0 +right = 0 +for i in A: +    if i < X: +        left += 1 -        R += 1 -print((min(L, R))) +        right += 1 +print((min(left, right)))