import collections

N=int(eval(input()))

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

a_counter=collections.Counter(a)

answer = 0

# print(a_counter)

# print(a_counter[0])

# print(a_counter[1])

# print(a_counter[2])

# print(a_counter[3])

for i in a_counter:

    # print(i)

    # print(i == a_counter[i])

    if i != a_counter[i]:

        if i < a_counter[i]:

            answer += a_counter[i] - i

        else:

            answer += a_counter[i]



print(answer)
import collections

N = int(eval(input()))

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

a_count = collections.Counter(a)

# print(a_count)

ans = 0

for i, j in list(a_count.items()):

    # print(i, j)

    if i <= j:

        ans += j - i

    else:

        ans += j



print(ans)
import collections

N = int(eval(input()))
a = list(map(int, input().split()))
a_counter = collections.Counter(a)
answer = 0
# print(a_counter)
# print(a_counter[0])
# print(a_counter[1])
# print(a_counter[2])
# print(a_counter[3])
for i in a_counter:
    # print(i)
    # print(i == a_counter[i])
    if i != a_counter[i]:
        if i < a_counter[i]:
            answer += a_counter[i] - i
        else:
            answer += a_counter[i]
print(answer)

import collections

N = int(eval(input()))
a = list(map(int, input().split()))
a_count = collections.Counter(a)
# print(a_count)
ans = 0
for i, j in list(a_count.items()):
    # print(i, j)
    if i <= j:
        ans += j - i
    else:
        ans += j
print(ans)

-a_counter = collections.Counter(a) -answer = 0 -# print(a_counter) -# print(a_counter[0]) -# print(a_counter[1]) -# print(a_counter[2]) -# print(a_counter[3]) -for i in a_counter: -    # print(i) -    # print(i == a_counter[i]) -    if i != a_counter[i]: -        if i < a_counter[i]: -            answer += a_counter[i] - i -        else: -            answer += a_counter[i] -print(answer) +a_count = collections.Counter(a) +# print(a_count) +ans = 0 +for i, j in list(a_count.items()): +    # print(i, j) +    if i <= j: +        ans += j - i +    else: +        ans += j +print(ans)