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

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

s=0

i=0

while a[i]<=x:

    s+=1

    i+=1

print((min(s,m-s)))
n,m,x=list(map(int,input().split()))

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

i=0

while a[i]<=x:

    i+=1

print((min(i,m-i)))
n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))
s = 0
i = 0
while a[i] <= x:
    s += 1
    i += 1
print((min(s, m - s)))

n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))
i = 0
while a[i] <= x:
    i += 1
print((min(i, m - i)))

-s = 0 -    s += 1 -print((min(s, m - s))) +print((min(i, m - i)))