n = int(eval(input()))

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



import collections



ac = collections.Counter(a)

common = ac.most_common()



operation_count = 0

for num, num_count in common:

  if num < num_count:

    operation_count += num_count - num

  elif num_count < num:

    operation_count += num_count



print(operation_count)

    
n = int(eval(input()))

import collections



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

ac = collections.Counter(a)



la = len(a)

ans = 0

for k, c in list(ac.items()):

  if c < k:

    ans += c

  else:

    ans += c - k

    

print(ans)

n = int(eval(input()))
a = list(map(int, input().split()))
import collections

ac = collections.Counter(a)
common = ac.most_common()
operation_count = 0
for num, num_count in common:
    if num < num_count:
        operation_count += num_count - num
    elif num_count < num:
        operation_count += num_count
print(operation_count)

n = int(eval(input()))
import collections

a = list(map(int, input().split()))
ac = collections.Counter(a)
la = len(a)
ans = 0
for k, c in list(ac.items()):
    if c < k:
        ans += c
    else:
        ans += c - k
print(ans)

-a = list(map(int, input().split())) +a = list(map(int, input().split())) -common = ac.most_common() -operation_count = 0 -for num, num_count in common: -    if num < num_count: -        operation_count += num_count - num -    elif num_count < num: -        operation_count += num_count -print(operation_count) +la = len(a) +ans = 0 +for k, c in list(ac.items()): +    if c < k: +        ans += c +    else: +        ans += c - k +print(ans)