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

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

cnt = 0

for i in range(X,N+1):

    if i in A:

        cnt += 1

cntmin = cnt

cnt = 0

for i in range(X,-1,-1):

    if i in A:

        cnt += 1

cntmin = min(cntmin,cnt)

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

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

cnt = 0

for i in range(M):

    if X>A[i]:

        cnt += 1

print((min(cnt,M-cnt)))
N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
cnt = 0
for i in range(X, N + 1):
    if i in A:
        cnt += 1
cntmin = cnt
cnt = 0
for i in range(X, -1, -1):
    if i in A:
        cnt += 1
cntmin = min(cntmin, cnt)
print(cntmin)

N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
cnt = 0
for i in range(M):
    if X > A[i]:
        cnt += 1
print((min(cnt, M - cnt)))

-for i in range(X, N + 1): -    if i in A: +for i in range(M): +    if X > A[i]: -cntmin = cnt -cnt = 0 -for i in range(X, -1, -1): -    if i in A: -        cnt += 1 -cntmin = min(cntmin, cnt) -print(cntmin) +print((min(cnt, M - cnt)))