from collections import Counter





N = int(eval(input()))

cntr = Counter(list(map(int, input().split())))

ans = 0

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

    if k > v:

        ans += v

    else:

        ans += v - k

print(ans)

from collections import Counter



N, *A = list(map(int, open(0).read().split()))

cnt = Counter(A)

ans = 0

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

    if k > v:

        ans += v

    else:

        ans += v - k

print(ans)

from collections import Counter

N = int(eval(input()))
cntr = Counter(list(map(int, input().split())))
ans = 0
for k, v in list(cntr.items()):
    if k > v:
        ans += v
    else:
        ans += v - k
print(ans)

from collections import Counter

N, *A = list(map(int, open(0).read().split()))
cnt = Counter(A)
ans = 0
for k, v in list(cnt.items()):
    if k > v:
        ans += v
    else:
        ans += v - k
print(ans)

-N = int(eval(input())) -cntr = Counter(list(map(int, input().split()))) +N, *A = list(map(int, open(0).read().split())) +cnt = Counter(A) -for k, v in list(cntr.items()): +for k, v in list(cnt.items()):