n,m,x=list(map(int,input().split()))

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



left=0

right=0



for ai in a:

  if ai<x:

    left+=1

  else:

    right+=1

print((min(left,right)))
n,m,x=list(map(int,input().split()))

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



for i in a:

  s=sum(int(i)<x for i in a)

print((min(s,m-s)))
n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))
left = 0
right = 0
for ai in a:
    if ai < x:
        left += 1
    else:
        right += 1
print((min(left, right)))

n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in a:
    s = sum(int(i) < x for i in a)
print((min(s, m - s)))

-left = 0 -right = 0 -for ai in a: -    if ai < x: -        left += 1 -    else: -        right += 1 -print((min(left, right))) +for i in a: +    s = sum(int(i) < x for i in a) +print((min(s, m - s)))