from collections import Counter



N = int(eval(input()))

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



sum = 0



for a, cnt in counter.most_common():

    if a > cnt:

        sum += cnt

    else:

        sum += cnt - a



print(sum)

from collections import Counter



N = int(eval(input()))

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



sum = 0



for a, cnt in list(counter.items()):

    if a > cnt:

        sum += cnt

    else:

        sum += cnt - a



print(sum)

from collections import Counter

N = int(eval(input()))
counter = Counter(list(map(int, input().split())))
sum = 0
for a, cnt in counter.most_common():
    if a > cnt:
        sum += cnt
    else:
        sum += cnt - a
print(sum)

from collections import Counter

N = int(eval(input()))
counter = Counter(list(map(int, input().split())))
sum = 0
for a, cnt in list(counter.items()):
    if a > cnt:
        sum += cnt
    else:
        sum += cnt - a
print(sum)

-for a, cnt in counter.most_common(): +for a, cnt in list(counter.items()):