import bisect

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

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

p = bisect.bisect_left(a, X)

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

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

for i in range(m):

  if x < a[i]:

    break

else:

  i += 1

print((min(i, m - i)))
import bisect

N, M, X = list(map(int, input().split()))
a = list(map(int, input().split()))
p = bisect.bisect_left(a, X)
print((min(p, M - p)))

n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(m):
    if x < a[i]:
        break
else:
    i += 1
print((min(i, m - i)))

-import bisect - -N, M, X = list(map(int, input().split())) +n, m, x = list(map(int, input().split())) -p = bisect.bisect_left(a, X) -print((min(p, M - p))) +for i in range(m): +    if x < a[i]: +        break +else: +    i += 1 +print((min(i, m - i)))