import collections



n = int(eval(input()))

a = collections.Counter(list(map(int, input().split()))).most_common()

ans = 0

for i, j in a:

    if i > j:

        ans += j

    if i < j:

        ans += j - i

print(ans)

import collections



n = int(eval(input()))

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

ac = collections.Counter(a)

ans = 0

for i in list(ac.items()):

    if i[0] != i[1]:

        if i[1] > i[0]:

            ans += i[1] - i[0]

        else:

            ans += i[1]

print(ans)
import collections

n = int(eval(input()))
a = collections.Counter(list(map(int, input().split()))).most_common()
ans = 0
for i, j in a:
    if i > j:
        ans += j
    if i < j:
        ans += j - i
print(ans)

import collections

n = int(eval(input()))
a = list(map(int, input().split()))
ac = collections.Counter(a)
ans = 0
for i in list(ac.items()):
    if i[0] != i[1]:
        if i[1] > i[0]:
            ans += i[1] - i[0]
        else:
            ans += i[1]
print(ans)

-a = collections.Counter(list(map(int, input().split()))).most_common() +a = list(map(int, input().split())) +ac = collections.Counter(a) -for i, j in a: -    if i > j: -        ans += j -    if i < j: -        ans += j - i +for i in list(ac.items()): +    if i[0] != i[1]: +        if i[1] > i[0]: +            ans += i[1] - i[0] +        else: +            ans += i[1]