from collections import Counter

n = int(eval(input()))

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



count = Counter(a)



ans = 0

for i in list(count.items()):

  if i[1] < i[0]: ans += i[1]

  else: ans += abs(i[1]-i[0])

    

print(ans)
from collections import Counter

n = int(eval(input()))

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



count = Counter(a)

ans = 0

for k,v in list(count.items()):

  if k < v: ans += v-k

  elif v < k: ans += v

print(ans)
from collections import Counter

n = int(eval(input()))
a = list(map(int, input().split()))
count = Counter(a)
ans = 0
for i in list(count.items()):
    if i[1] < i[0]:
        ans += i[1]
    else:
        ans += abs(i[1] - i[0])
print(ans)

from collections import Counter

n = int(eval(input()))
a = list(map(int, input().split()))
count = Counter(a)
ans = 0
for k, v in list(count.items()):
    if k < v:
        ans += v - k
    elif v < k:
        ans += v
print(ans)

-for i in list(count.items()): -    if i[1] < i[0]: -        ans += i[1] -    else: -        ans += abs(i[1] - i[0]) +for k, v in list(count.items()): +    if k < v: +        ans += v - k +    elif v < k: +        ans += v