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

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

cnt = 0

min = 0

cnt_2 = 0

lists = list(range(N + 1))

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

    for j in range(len(A)):

        if i == 0 or i == N or i == X:

            continue

        elif i == A[j]:

            cnt += 1

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

    for n in range(len(A)):

        if m == 0 or m == N or m == X:

            continue

        elif m == A[n]:

            cnt_2 += 1

if cnt > cnt_2:

    min = cnt_2

elif cnt_2 > cnt:

    min = cnt

print(min)

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

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

cnt_r = 0

cnt_l = 0

road = [True]*(n+1)

for i in a:

    road[i] = False

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

    if not road[i]:

        cnt_r += 1

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

    if not road[i]:

        cnt_l += 1

ans = min(cnt_r,cnt_l)

print(ans)
N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
cnt = 0
min = 0
cnt_2 = 0
lists = list(range(N + 1))
for i in range(X, N + 1):
    for j in range(len(A)):
        if i == 0 or i == N or i == X:
            continue
        elif i == A[j]:
            cnt += 1
for m in range(X, -1, -1):
    for n in range(len(A)):
        if m == 0 or m == N or m == X:
            continue
        elif m == A[n]:
            cnt_2 += 1
if cnt > cnt_2:
    min = cnt_2
elif cnt_2 > cnt:
    min = cnt
print(min)

n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt_r = 0
cnt_l = 0
road = [True] * (n + 1)
for i in a:
    road[i] = False
for i in range(x, n + 1):
    if not road[i]:
        cnt_r += 1
for i in range(x, -1, -1):
    if not road[i]:
        cnt_l += 1
ans = min(cnt_r, cnt_l)
print(ans)

-N, M, X = list(map(int, input().split())) -A = list(map(int, input().split())) -cnt = 0 -min = 0 -cnt_2 = 0 -lists = list(range(N + 1)) -for i in range(X, N + 1): -    for j in range(len(A)): -        if i == 0 or i == N or i == X: -            continue -        elif i == A[j]: -            cnt += 1 -for m in range(X, -1, -1): -    for n in range(len(A)): -        if m == 0 or m == N or m == X: -            continue -        elif m == A[n]: -            cnt_2 += 1 -if cnt > cnt_2: -    min = cnt_2 -elif cnt_2 > cnt: -    min = cnt -print(min) +n, m, x = list(map(int, input().split())) +a = list(map(int, input().split())) +cnt_r = 0 +cnt_l = 0 +road = [True] * (n + 1) +for i in a: +    road[i] = False +for i in range(x, n + 1): +    if not road[i]: +        cnt_r += 1 +for i in range(x, -1, -1): +    if not road[i]: +        cnt_l += 1 +ans = min(cnt_r, cnt_l) +print(ans)