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

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

up = len(list([x for x in a if x>p]))

down = len(list([x for x in a if x<p]))

print((min(up,down)))
import sys

INF = 1 << 60

MOD = 10**9 + 7 # 998244353

sys.setrecursionlimit(2147483647)

input = lambda:sys.stdin.readline().rstrip()

def resolve():

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

    toll = [False] * (n + 1)

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

        toll[a] = True



    back = 0

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

        back += toll[i]

    forth = 0

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

        forth += toll[i]

    print((min(back, forth)))

resolve()
n, m, p = list(map(int, input().split()))
a = list(map(int, input().split()))
up = len(list([x for x in a if x > p]))
down = len(list([x for x in a if x < p]))
print((min(up, down)))

import sys

INF = 1 << 60
MOD = 10**9 + 7  # 998244353
sys.setrecursionlimit(2147483647)
input = lambda: sys.stdin.readline().rstrip()


def resolve():
    n, m, x = list(map(int, input().split()))
    toll = [False] * (n + 1)
    for a in map(int, input().split()):
        toll[a] = True
    back = 0
    for i in range(x - 1, -1, -1):
        back += toll[i]
    forth = 0
    for i in range(x + 1, n + 1):
        forth += toll[i]
    print((min(back, forth)))


resolve()

-n, m, p = list(map(int, input().split())) -a = list(map(int, input().split())) -up = len(list([x for x in a if x > p])) -down = len(list([x for x in a if x < p])) -print((min(up, down))) +import sys + +INF = 1 << 60 +MOD = 10**9 + 7  # 998244353 +sys.setrecursionlimit(2147483647) +input = lambda: sys.stdin.readline().rstrip() + + +def resolve(): +    n, m, x = list(map(int, input().split())) +    toll = [False] * (n + 1) +    for a in map(int, input().split()): +        toll[a] = True +    back = 0 +    for i in range(x - 1, -1, -1): +        back += toll[i] +    forth = 0 +    for i in range(x + 1, n + 1): +        forth += toll[i] +    print((min(back, forth))) + + +resolve()