from collections import defaultdict

N = int(eval(input()))

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

D = defaultdict(int)



for i in range(N):

    D[A[i]] += 1



delete = 0

for d in D:

    if d < D[d]:

        delete += D[d] - d

    elif d > D[d]:

        delete += D[d]

print(delete)

import sys



def solve():

    input = sys.stdin.readline

    N = int(eval(input()))

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

    AD = dict()

    for a in A:

        if a in AD: AD[a] += 1

        else: AD[a] = 1



    count = 0

    for key in AD:

        if AD[key] == key: continue

        elif AD[key] > key: count += AD[key] - key

        else: count += AD[key]

    print(count)



    return 0



if __name__ == "__main__":

    solve()
from collections import defaultdict

N = int(eval(input()))
A = [int(i) for i in input().split()]
D = defaultdict(int)
for i in range(N):
    D[A[i]] += 1
delete = 0
for d in D:
    if d < D[d]:
        delete += D[d] - d
    elif d > D[d]:
        delete += D[d]
print(delete)

import sys


def solve():
    input = sys.stdin.readline
    N = int(eval(input()))
    A = [int(a) for a in input().split()]
    AD = dict()
    for a in A:
        if a in AD:
            AD[a] += 1
        else:
            AD[a] = 1
    count = 0
    for key in AD:
        if AD[key] == key:
            continue
        elif AD[key] > key:
            count += AD[key] - key
        else:
            count += AD[key]
    print(count)
    return 0


if __name__ == "__main__":
    solve()

-from collections import defaultdict +import sys -N = int(eval(input())) -A = [int(i) for i in input().split()] -D = defaultdict(int) -for i in range(N): -    D[A[i]] += 1 -delete = 0 -for d in D: -    if d < D[d]: -        delete += D[d] - d -    elif d > D[d]: -        delete += D[d] -print(delete) + +def solve(): +    input = sys.stdin.readline +    N = int(eval(input())) +    A = [int(a) for a in input().split()] +    AD = dict() +    for a in A: +        if a in AD: +            AD[a] += 1 +        else: +            AD[a] = 1 +    count = 0 +    for key in AD: +        if AD[key] == key: +            continue +        elif AD[key] > key: +            count += AD[key] - key +        else: +            count += AD[key] +    print(count) +    return 0 + + +if __name__ == "__main__": +    solve()