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

a = [0] * (n + 1)

for _ in map(int, input().split()):

    a[_ - 1] = 1

print(min(sum(a[:x - 1]), sum(a[x:])))





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

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

p = len([a for a in A if a < X])

q = len([a for a in A if a > X])

print(min(p, q))
n, m, x = list(map(int, input().split()))
a = [0] * (n + 1)
for _ in map(int, input().split()):
    a[_ - 1] = 1
print(min(sum(a[: x - 1]), sum(a[x:])))

N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
p = len([a for a in A if a < X])
q = len([a for a in A if a > X])
print(min(p, q))

-n, m, x = list(map(int, input().split())) -a = [0] * (n + 1) -for _ in map(int, input().split()): -    a[_ - 1] = 1 -print(min(sum(a[: x - 1]), sum(a[x:]))) +N, M, X = list(map(int, input().split())) +A = list(map(int, input().split())) +p = len([a for a in A if a < X]) +q = len([a for a in A if a > X]) +print(min(p, q))