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

F = [0 for _ in range(N+1)]

for A in input().split():

	F[int(A)] = 1

print((min(sum(F[:X+1]), sum(F[X:]))))
n,m,x=list(map(int,input().split()))

s=sum(int(a)<x for a in input().split())

print((min(s,m-s)))
N, M, X = list(map(int, input().split()))
F = [0 for _ in range(N + 1)]
for A in input().split():
    F[int(A)] = 1
print((min(sum(F[: X + 1]), sum(F[X:]))))

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

-N, M, X = list(map(int, input().split())) -F = [0 for _ in range(N + 1)] -for A in input().split(): -    F[int(A)] = 1 -print((min(sum(F[: X + 1]), sum(F[X:])))) +n, m, x = list(map(int, input().split())) +s = sum(int(a) < x for a in input().split()) +print((min(s, m - s)))