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

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

left, right = 0,0

for ai in A:

  if ai < X: left+=1

  else: right+=1

print((min(right, left)))
N, M, X = list(map(int, input().split(" ")))

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

r = len([ai for ai in A if ai < X])

l = len([ai for ai in A if ai > X])

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

N, M, X = list(map(int, input().split(" ")))
A = list(map(int, input().split(" ")))
r = len([ai for ai in A if ai < X])
l = len([ai for ai in A if ai > X])
print((min((r, l))))

-left, right = 0, 0 -for ai in A: -    if ai < X: -        left += 1 -    else: -        right += 1 -print((min(right, left))) +r = len([ai for ai in A if ai < X]) +l = len([ai for ai in A if ai > X]) +print((min((r, l))))