from collections import defaultdict



N = int(eval(input()))

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



c = defaultdict(lambda: 0)

for a_i in a:

    c[a_i] += 1



ans = 0

for i, j in list(c.items()):

    if i > j:

        ans += j

    elif i < j:

        ans += j - i

print(ans)

from collections import Counter



N = int(eval(input()))

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



c = Counter(a)

ans = 0

for k, v in list(c.items()):

    if k < v:

        ans += v - k

    elif k > v:

        ans += v

print(ans)
from collections import defaultdict

N = int(eval(input()))
a = [int(x) for x in input().split()]
c = defaultdict(lambda: 0)
for a_i in a:
    c[a_i] += 1
ans = 0
for i, j in list(c.items()):
    if i > j:
        ans += j
    elif i < j:
        ans += j - i
print(ans)

from collections import Counter

N = int(eval(input()))
a = [int(x) for x in input().split()]
c = Counter(a)
ans = 0
for k, v in list(c.items()):
    if k < v:
        ans += v - k
    elif k > v:
        ans += v
print(ans)

-from collections import defaultdict +from collections import Counter -c = defaultdict(lambda: 0) -for a_i in a: -    c[a_i] += 1 +c = Counter(a) -for i, j in list(c.items()): -    if i > j: -        ans += j -    elif i < j: -        ans += j - i +for k, v in list(c.items()): +    if k < v: +        ans += v - k +    elif k > v: +        ans += v