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

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

A_under = [A[i] for i in range(M) if A[i] < X]

A_upper = [A[i] for i in range(M) if A[i] > X]

print((min(len(A_under),len(A_upper))))
N,M,X = list(map(int,input().split()))

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

cost = [0]*N

for i in A: cost[i] = 1

print((min(sum(cost[X:]),sum(cost[:X+1]))))
N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
A_under = [A[i] for i in range(M) if A[i] < X]
A_upper = [A[i] for i in range(M) if A[i] > X]
print((min(len(A_under), len(A_upper))))

N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
cost = [0] * N
for i in A:
    cost[i] = 1
print((min(sum(cost[X:]), sum(cost[: X + 1]))))

-A_under = [A[i] for i in range(M) if A[i] < X] -A_upper = [A[i] for i in range(M) if A[i] > X] -print((min(len(A_under), len(A_upper)))) +cost = [0] * N +for i in A: +    cost[i] = 1 +print((min(sum(cost[X:]), sum(cost[: X + 1]))))