from collections import Counter

n = eval(input())

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

print((sum(0 if c[key] == key else c[key] if c[key] < key else c[key] - key for key in c)))

from collections import Counter

n = eval(input())

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

print((sum(v if v < k else v - k for k,v in list(c.items()))))

from collections import Counter

n = eval(input())
c = Counter(list(map(int, input().split())))
print(
    (sum(0 if c[key] == key else c[key] if c[key] < key else c[key] - key for key in c))
)

from collections import Counter

n = eval(input())
c = Counter(list(map(int, input().split())))
print((sum(v if v < k else v - k for k, v in list(c.items()))))

-print( -    (sum(0 if c[key] == key else c[key] if c[key] < key else c[key] - key for key in c)) -) +print((sum(v if v < k else v - k for k, v in list(c.items()))))