import collections

N=int(eval(input()))

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

c = collections.Counter(A)

ans=0

n=len(set(A))

c_=c.most_common()

for i in range(n):

    a=int(c_[i][0])

    b=c_[i][1]

    if a <= b:

        ans+=b-a

    else:

        ans+=b

print(ans)
# coding: utf-8

import collections

N = int(eval(input()))

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



A.sort()



c = collections.Counter(A)

A_ = list(set(A))

ans = 0

for a in A_:

    #print(c[a],a)

    if a > c[a]:

        ans += c[a]

    else:

        ans += c[a]-a

    

print(ans)
import collections

N = int(eval(input()))
A = list(map(int, input().split()))
c = collections.Counter(A)
ans = 0
n = len(set(A))
c_ = c.most_common()
for i in range(n):
    a = int(c_[i][0])
    b = c_[i][1]
    if a <= b:
        ans += b - a
    else:
        ans += b
print(ans)

# coding: utf-8
import collections

N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
c = collections.Counter(A)
A_ = list(set(A))
ans = 0
for a in A_:
    # print(c[a],a)
    if a > c[a]:
        ans += c[a]
    else:
        ans += c[a] - a
print(ans)

+# coding: utf-8 +A.sort() +A_ = list(set(A)) -n = len(set(A)) -c_ = c.most_common() -for i in range(n): -    a = int(c_[i][0]) -    b = c_[i][1] -    if a <= b: -        ans += b - a +for a in A_: +    # print(c[a],a) +    if a > c[a]: +        ans += c[a] -        ans += b +        ans += c[a] - a