from collections import Counter

from collections import deque



n = int(eval(input()))

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

c = Counter(a)

c = c.most_common()

ans = 0

for num, cnt in c:

    if cnt>=num:

        ans += cnt - num

    else:

        ans += cnt

print(ans)
from collections import Counter

n = int(eval(input()))

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

c = Counter(a)

ans = 0

for num, cnt in list(c.items()):

    if cnt>=num:

        ans += cnt - num

    else:

        ans += cnt

print(ans)

from collections import Counter
from collections import deque

n = int(eval(input()))
a = list(map(int, input().split()))
c = Counter(a)
c = c.most_common()
ans = 0
for num, cnt in c:
    if cnt >= num:
        ans += cnt - num
    else:
        ans += cnt
print(ans)

from collections import Counter

n = int(eval(input()))
a = list(map(int, input().split()))
c = Counter(a)
ans = 0
for num, cnt in list(c.items()):
    if cnt >= num:
        ans += cnt - num
    else:
        ans += cnt
print(ans)

-from collections import deque -c = c.most_common() -for num, cnt in c: +for num, cnt in list(c.items()):