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

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



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

for n in A:

    a[n] = 1



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

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

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

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

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