from collections import Counter

N = int(eval(input()))

a = [int(i) for i in input().split()]

b = Counter(a)

ans = 0

for x in b:

    if b[x] > x:

        ans += b[x] - x

    elif b[x] < x:

        ans += b[x]

print(ans)
from collections import Counter

N = int(eval(input()))

a = [int(i) for i in input().split()]



ans = 0

m = Counter(a)

for x, y in list(m.items()):

    if x == y:

        continue

    elif x < y:

        ans += abs(y-x)

    else:

        ans += y

print(ans)
from collections import Counter

N = int(eval(input()))
a = [int(i) for i in input().split()]
b = Counter(a)
ans = 0
for x in b:
    if b[x] > x:
        ans += b[x] - x
    elif b[x] < x:
        ans += b[x]
print(ans)

from collections import Counter

N = int(eval(input()))
a = [int(i) for i in input().split()]
ans = 0
m = Counter(a)
for x, y in list(m.items()):
    if x == y:
        continue
    elif x < y:
        ans += abs(y - x)
    else:
        ans += y
print(ans)

-b = Counter(a) -for x in b: -    if b[x] > x: -        ans += b[x] - x -    elif b[x] < x: -        ans += b[x] +m = Counter(a) +for x, y in list(m.items()): +    if x == y: +        continue +    elif x < y: +        ans += abs(y - x) +    else: +        ans += y