from collections import Counter

N = int(eval(input()))

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

ctr = Counter(src)



ans = 0

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

    if k < v:

        ans += v-k

    elif k > v:

        ans += v

print(ans)

from collections import Counter

N = int(eval(input()))

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

ctr = Counter(src)

ans = 0

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

    ans += v if v<k else v-k

print(ans)
from collections import Counter

N = int(eval(input()))
src = list(map(int, input().split()))
ctr = Counter(src)
ans = 0
for k, v in list(ctr.items()):
    if k < v:
        ans += v - k
    elif k > v:
        ans += v
print(ans)

from collections import Counter

N = int(eval(input()))
src = list(map(int, input().split()))
ctr = Counter(src)
ans = 0
for k, v in list(ctr.items()):
    ans += v if v < k else v - k
print(ans)

-    if k < v: -        ans += v - k -    elif k > v: -        ans += v +    ans += v if v < k else v - k