import sys

import collections

# import math

# import string

# import bisect

# import re

# import itertools

# import statistics



def main():



    n, *a = (int(x) for x in sys.stdin.read().split())

    c = collections.Counter(a)

    count = 0

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

        if j < i: count += j

        else: count += j - i

    

    print(count)

    

if __name__ == "__main__":

    # execute only if run as a script

    main()

import sys

from collections import Counter



n, *a = list(map(int, sys.stdin.read().split()))



def main():

    res = 0

    for v, c in list(Counter(a).items()):

        if c < v:

            res += c

        elif c > v:

            res += c - v

    return res



if __name__ == '__main__':

    ans = main()

    print(ans)
import sys
import collections

# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
def main():
    n, *a = (int(x) for x in sys.stdin.read().split())
    c = collections.Counter(a)
    count = 0
    for i, j in list(c.items()):
        if j < i:
            count += j
        else:
            count += j - i
    print(count)


if __name__ == "__main__":
    # execute only if run as a script
    main()

import sys
from collections import Counter

n, *a = list(map(int, sys.stdin.read().split()))


def main():
    res = 0
    for v, c in list(Counter(a).items()):
        if c < v:
            res += c
        elif c > v:
            res += c - v
    return res


if __name__ == "__main__":
    ans = main()
    print(ans)

-import collections +from collections import Counter -# import math -# import string -# import bisect -# import re -# import itertools -# import statistics +n, *a = list(map(int, sys.stdin.read().split())) + + -    n, *a = (int(x) for x in sys.stdin.read().split()) -    c = collections.Counter(a) -    count = 0 -    for i, j in list(c.items()): -        if j < i: -            count += j -        else: -            count += j - i -    print(count) +    res = 0 +    for v, c in list(Counter(a).items()): +        if c < v: +            res += c +        elif c > v: +            res += c - v +    return res -    # execute only if run as a script -    main() +    ans = main() +    print(ans)