import collections



N=int(eval(input()))

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

a.sort()



cnt=0



c=collections.Counter(a)

#print(c)



for item in c:

  t=c[item]

  if t>item:

    cnt+=t-item

  elif t==item:

    pass

  else:

    cnt+=t



#while len(a)>0:

#  item=a[0]

#  t=(item)

#  #print(item,t,a)

#  if t>item:

#    cnt+=t-item

#  elif t==item:

#    pass

#  else:

#    cnt+=t

#  del a[0:t]

#  #print("after",a)

  

print(cnt)
import collections



N=int(eval(input()))

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

c=collections.Counter(a)



cnt=0



for item in c:

  t=c[item]

  if t>item:

    cnt+=t-item

  elif t==item:

    pass

  else:

    cnt+=t

  

print(cnt)
import collections

N = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
cnt = 0
c = collections.Counter(a)
# print(c)
for item in c:
    t = c[item]
    if t > item:
        cnt += t - item
    elif t == item:
        pass
    else:
        cnt += t
# while len(a)>0:
#  item=a[0]
#  t=(item)
#  #print(item,t,a)
#  if t>item:
#    cnt+=t-item
#  elif t==item:
#    pass
#  else:
#    cnt+=t
#  del a[0:t]
#  #print("after",a)
print(cnt)

import collections

N = int(eval(input()))
a = list(map(int, input().split()))
c = collections.Counter(a)
cnt = 0
for item in c:
    t = c[item]
    if t > item:
        cnt += t - item
    elif t == item:
        pass
    else:
        cnt += t
print(cnt)

-a.sort() +c = collections.Counter(a) -c = collections.Counter(a) -# print(c) -# while len(a)>0: -#  item=a[0] -#  t=(item) -#  #print(item,t,a) -#  if t>item: -#    cnt+=t-item -#  elif t==item: -#    pass -#  else: -#    cnt+=t -#  del a[0:t] -#  #print("after",a)