# -*- coding: utf-8 -*-



# AtCoder Beginner Contest

# Problem C



if __name__ == '__main__':

    n = int(eval(input()))

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

    count = 0



    from collections import Counter

    counted_a = Counter(a)



    for x in counted_a:

        if counted_a[x] >= x:

            count += counted_a[x] - x

        else:

            count += counted_a[x]



    print(count)

# -*- coding: utf-8 -*-





def main():

    from collections import Counter



    n = int(eval(input()))

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

    ans = 0



    for key, value in list(a.items()):

        if key < value:

            ans += value - key

        elif key > value:

            ans += value



    print(ans)





if __name__ == '__main__':

    main()

# -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == "__main__":
    n = int(eval(input()))
    a = list(map(int, input().split()))
    count = 0
    from collections import Counter

    counted_a = Counter(a)
    for x in counted_a:
        if counted_a[x] >= x:
            count += counted_a[x] - x
        else:
            count += counted_a[x]
    print(count)

# -*- coding: utf-8 -*-
def main():
    from collections import Counter

    n = int(eval(input()))
    a = Counter(list(map(int, input().split())))
    ans = 0
    for key, value in list(a.items()):
        if key < value:
            ans += value - key
        elif key > value:
            ans += value
    print(ans)


if __name__ == "__main__":
    main()

-# AtCoder Beginner Contest -# Problem C -if __name__ == "__main__": -    n = int(eval(input())) -    a = list(map(int, input().split())) -    count = 0 +def main(): -    counted_a = Counter(a) -    for x in counted_a: -        if counted_a[x] >= x: -            count += counted_a[x] - x -        else: -            count += counted_a[x] -    print(count) +    n = int(eval(input())) +    a = Counter(list(map(int, input().split()))) +    ans = 0 +    for key, value in list(a.items()): +        if key < value: +            ans += value - key +        elif key > value: +            ans += value +    print(ans) + + +if __name__ == "__main__": +    main()