# ABC082C - Good Sequence (ARC087C)

import sys

input = sys.stdin.readline



def main():

    n = int(eval(input()))

    lst = list(map(int, input().rstrip().split()))

    cnt = {}

    for i in lst:

        if i not in cnt:

            cnt[i] = 0

        cnt[i] += 1

    ans = 0

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

        if i > j:

            ans += j

        elif i < j:

            ans += j - i

    print(ans)





if __name__ == "__main__":

    main()
# ABC082C - Good Sequence (ARC087C)

from collections import Counter





def main():

    N, *A = list(map(int, open(0).read().split()))

    C = Counter(A)

    ans = sum(j if i > j else j - i for i, j in list(C.items()))

    print(ans)





if __name__ == "__main__":

    main()
# ABC082C - Good Sequence (ARC087C)
import sys

input = sys.stdin.readline


def main():
    n = int(eval(input()))
    lst = list(map(int, input().rstrip().split()))
    cnt = {}
    for i in lst:
        if i not in cnt:
            cnt[i] = 0
        cnt[i] += 1
    ans = 0
    for i, j in list(cnt.items()):
        if i > j:
            ans += j
        elif i < j:
            ans += j - i
    print(ans)


if __name__ == "__main__":
    main()

# ABC082C - Good Sequence (ARC087C)
from collections import Counter


def main():
    N, *A = list(map(int, open(0).read().split()))
    C = Counter(A)
    ans = sum(j if i > j else j - i for i, j in list(C.items()))
    print(ans)


if __name__ == "__main__":
    main()

-import sys - -input = sys.stdin.readline +from collections import Counter -    n = int(eval(input())) -    lst = list(map(int, input().rstrip().split())) -    cnt = {} -    for i in lst: -        if i not in cnt: -            cnt[i] = 0 -        cnt[i] += 1 -    ans = 0 -    for i, j in list(cnt.items()): -        if i > j: -            ans += j -        elif i < j: -            ans += j - i +    N, *A = list(map(int, open(0).read().split())) +    C = Counter(A) +    ans = sum(j if i > j else j - i for i, j in list(C.items()))