from collections import Counter,defaultdict,deque

from heapq import heappop,heappush,heapify

import sys,bisect,math,itertools

sys.setrecursionlimit(10**8)

mod = 10**9+7

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))



n,m,x = inpl()

a = inpl()

for i in range(m):

    if a[i] >= x:

        break

print((min(i,m-i)))
from collections import Counter,defaultdict,deque

from heapq import heappop,heappush

from bisect import bisect_left,bisect_right 

import sys,math,itertools,fractions,pprint

sys.setrecursionlimit(10**8)

mod = 10**9+7

INF = float('inf')

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))



n,m,X = inpl()

a = inpl()

f = [False] * n

for x in a:

    f[x] = True

print((min(sum(f[:X]), sum(f[X:]))))

from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools

sys.setrecursionlimit(10**8)
mod = 10**9 + 7


def inp():
    return int(sys.stdin.readline())


def inpl():
    return list(map(int, sys.stdin.readline().split()))


def inpln(n):
    return list(int(sys.stdin.readline()) for i in range(n))


n, m, x = inpl()
a = inpl()
for i in range(m):
    if a[i] >= x:
        break
print((min(i, m - i)))

from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint

sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")


def inp():
    return int(sys.stdin.readline())


def inpl():
    return list(map(int, sys.stdin.readline().split()))


n, m, X = inpl()
a = inpl()
f = [False] * n
for x in a:
    f[x] = True
print((min(sum(f[:X]), sum(f[X:]))))

-from heapq import heappop, heappush, heapify -import sys, bisect, math, itertools +from heapq import heappop, heappush +from bisect import bisect_left, bisect_right +import sys, math, itertools, fractions, pprint +INF = float("inf") -def inpln(n): -    return list(int(sys.stdin.readline()) for i in range(n)) - - -n, m, x = inpl() +n, m, X = inpl() -for i in range(m): -    if a[i] >= x: -        break -print((min(i, m - i))) +f = [False] * n +for x in a: +    f[x] = True +print((min(sum(f[:X]), sum(f[X:]))))