#!/usr/bin/env python3

# coding=utf-8



import collections

import sys



n = sys.stdin.readline().strip()

a = sys.stdin.readline().strip().split(" ")

a_count = collections.Counter(a)

ans = 0

for k, v in list(a_count.items()):

    if int(k) > v:

        ans += v

    else:

        ans += v - int(k)

print(ans)
from collections import Counter





def solve(string):

    n, *a = list(map(int, string.split()))

    count = Counter(a)

    return str(sum([v if int(k) > v else v - int(k) for k, v in list(count.items())]))





if __name__ == '__main__':

    print((solve('\n'.join([eval(input()), eval(input())]))))

#!/usr/bin/env python3
# coding=utf-8
import collections
import sys

n = sys.stdin.readline().strip()
a = sys.stdin.readline().strip().split(" ")
a_count = collections.Counter(a)
ans = 0
for k, v in list(a_count.items()):
    if int(k) > v:
        ans += v
    else:
        ans += v - int(k)
print(ans)

from collections import Counter


def solve(string):
    n, *a = list(map(int, string.split()))
    count = Counter(a)
    return str(sum([v if int(k) > v else v - int(k) for k, v in list(count.items())]))


if __name__ == "__main__":
    print((solve("\n".join([eval(input()), eval(input())]))))

-#!/usr/bin/env python3 -# coding=utf-8 -import collections -import sys +from collections import Counter -n = sys.stdin.readline().strip() -a = sys.stdin.readline().strip().split(" ") -a_count = collections.Counter(a) -ans = 0 -for k, v in list(a_count.items()): -    if int(k) > v: -        ans += v -    else: -        ans += v - int(k) -print(ans) + +def solve(string): +    n, *a = list(map(int, string.split())) +    count = Counter(a) +    return str(sum([v if int(k) > v else v - int(k) for k, v in list(count.items())])) + + +if __name__ == "__main__": +    print((solve("\n".join([eval(input()), eval(input())]))))