import collections

n = int(eval(input()))

a = list(map(int, input().split()))

aa = collections.Counter(a)

ans = 0

for i,j in sorted(aa.items()):

	if j > i:

		ans += j-i

	elif j < i:

		ans += j

print (ans)

from collections import Counter

n = int(eval(input()))

a = list(map(int, input().split()))



c = Counter(a)

ans = 0

for i in c:

	if c[i] > i:

		ans += c[i] - i

	elif c[i] < i:

		ans += c[i]

print (ans)
import collections

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

from collections import Counter

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

-import collections +from collections import Counter -aa = collections.Counter(a) +c = Counter(a) -for i, j in sorted(aa.items()): -    if j > i: -        ans += j - i -    elif j < i: -        ans += j +for i in c: +    if c[i] > i: +        ans += c[i] - i +    elif c[i] < i: +        ans += c[i]