# encoding:utf-8

import copy

import numpy as np

import random



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



a = [int(i) for i in input().split()]







#migi

cost_r = 0

for i in range(x,n):

    if i in a:

        cost_r += 1



cost_l = 0

for i in range(x):

    if i in a:

        cost_l += 1



print((min(cost_l,cost_r)))

#!/usr/bin/env python3

# encoding:utf-8

import copy

import random

import bisect #bisect_left　これで二部探索の大小検索が行える

import fractions #最小公倍数などはこっち

import math

import sys

import collections

from decimal import Decimal # 10進数で考慮できる



mod = 10**9+7

sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000



d = collections.deque()

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



N, M, X = LI()

A = LI()



left = 0

right = 0



cs = [0 for i in range(N)]

for a in A:

    cs[a] = 1

for i in range(X):

    if cs[i]:

        left += 1



for i in range(X, N):

    if cs[i]:

        right += 1



print((min(left, right)))
# encoding:utf-8
import copy
import numpy as np
import random

n, m, x = list(map(int, input().split()))
a = [int(i) for i in input().split()]
# migi
cost_r = 0
for i in range(x, n):
    if i in a:
        cost_r += 1
cost_l = 0
for i in range(x):
    if i in a:
        cost_l += 1
print((min(cost_l, cost_r)))

#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect  # bisect_left　これで二部探索の大小検索が行える
import fractions  # 最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal  # 10進数で考慮できる

mod = 10**9 + 7
sys.setrecursionlimit(mod)  # 再帰回数上限はでdefault1000
d = collections.deque()


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


N, M, X = LI()
A = LI()
left = 0
right = 0
cs = [0 for i in range(N)]
for a in A:
    cs[a] = 1
for i in range(X):
    if cs[i]:
        left += 1
for i in range(X, N):
    if cs[i]:
        right += 1
print((min(left, right)))

+#!/usr/bin/env python3 -import numpy as np +import bisect  # bisect_left　これで二部探索の大小検索が行える +import fractions  # 最小公倍数などはこっち +import math +import sys +import collections +from decimal import Decimal  # 10進数で考慮できる -n, m, x = list(map(int, input().split())) -a = [int(i) for i in input().split()] -# migi -cost_r = 0 -for i in range(x, n): -    if i in a: -        cost_r += 1 -cost_l = 0 -for i in range(x): -    if i in a: -        cost_l += 1 -print((min(cost_l, cost_r))) +mod = 10**9 + 7 +sys.setrecursionlimit(mod)  # 再帰回数上限はでdefault1000 +d = collections.deque() + + +def LI(): +    return list(map(int, sys.stdin.readline().split())) + + +N, M, X = LI() +A = LI() +left = 0 +right = 0 +cs = [0 for i in range(N)] +for a in A: +    cs[a] = 1 +for i in range(X): +    if cs[i]: +        left += 1 +for i in range(X, N): +    if cs[i]: +        right += 1 +print((min(left, right)))