from collections import Counter

n=int(eval(input()))

a=Counter(input().split())

count=0

keys,counts=list(zip(*a.most_common()))

for i,j in zip(keys,counts):

    i=int(i)

    if i>j:

        count+=j

    elif i<j:

        count+=j-i

print(count)
from collections import Counter

n=int(eval(input()))

a=Counter(input().split())

ans=0

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

    i=int(i)

    if i>j:

        ans+=j

    elif i<j:

        ans+=j-i

print(ans)
from collections import Counter

n = int(eval(input()))
a = Counter(input().split())
count = 0
keys, counts = list(zip(*a.most_common()))
for i, j in zip(keys, counts):
    i = int(i)
    if i > j:
        count += j
    elif i < j:
        count += j - i
print(count)

from collections import Counter

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

-count = 0 -keys, counts = list(zip(*a.most_common())) -for i, j in zip(keys, counts): +ans = 0 +for i, j in list(a.items()): -        count += j +        ans += j -        count += j - i -print(count) +        ans += j - i +print(ans)