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

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

c = 0

d = 0

for i in range(x):

    if i in a:

        c += 1

for i in range(x+1,n+1):

    if i in a:

        d += 1

print((min(c,d)))

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

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

left=0

right=0

for a in A:

    if a<x:

        left+=1

    else:

        right+=1

print((min(left,right)))

n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))
c = 0
d = 0
for i in range(x):
    if i in a:
        c += 1
for i in range(x + 1, n + 1):
    if i in a:
        d += 1
print((min(c, d)))

n, m, x = list(map(int, input().split()))
A = list(map(int, input().split()))
left = 0
right = 0
for a in A:
    if a < x:
        left += 1
    else:
        right += 1
print((min(left, right)))

-a = list(map(int, input().split())) -c = 0 -d = 0 -for i in range(x): -    if i in a: -        c += 1 -for i in range(x + 1, n + 1): -    if i in a: -        d += 1 -print((min(c, d))) +A = list(map(int, input().split())) +left = 0 +right = 0 +for a in A: +    if a < x: +        left += 1 +    else: +        right += 1 +print((min(left, right)))