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

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



to_0 = 0

if A[-1] < X:

    to_0 = M

    to_N = 0

elif A[0] < X < A[-1]:

    for i in A:

        if i < X:

            to_0 += 1

    to_N = M - to_0

elif X < A[0]:

    to_0 = 0

    to_N = M

print((min(to_0, to_N)))
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()))
to_0 = 0
if A[-1] < X:
    to_0 = M
    to_N = 0
elif A[0] < X < A[-1]:
    for i in A:
        if i < X:
            to_0 += 1
    to_N = M - to_0
elif X < A[0]:
    to_0 = 0
    to_N = M
print((min(to_0, to_N)))

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())) -to_0 = 0 -if A[-1] < X: -    to_0 = M -    to_N = 0 -elif A[0] < X < A[-1]: -    for i in A: -        if i < X: -            to_0 += 1 -    to_N = M - to_0 -elif X < A[0]: -    to_0 = 0 -    to_N = M -print((min(to_0, to_N))) +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)))