from collections import Counter

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

c = Counter(a)

ans = 0

for v in c:

  if v > c[v]:

    ans += c[v]

  else:

    ans += c[v] - v

print(ans)

from collections import Counter

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

c = Counter(a)

print((sum(c[v] if v > c[v] else c[v] - v for v in c)))

from collections import Counter

N, *a = list(map(int, open(0).read().split()))
c = Counter(a)
ans = 0
for v in c:
    if v > c[v]:
        ans += c[v]
    else:
        ans += c[v] - v
print(ans)

from collections import Counter

N, *a = list(map(int, open(0).read().split()))
c = Counter(a)
print((sum(c[v] if v > c[v] else c[v] - v for v in c)))

-ans = 0 -for v in c: -    if v > c[v]: -        ans += c[v] -    else: -        ans += c[v] - v -print(ans) +print((sum(c[v] if v > c[v] else c[v] - v for v in c)))