You are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N). Your objective is to remove some of the elements in a so that a will be a good sequence. Here, a sequence b is a good sequence when for each element x in b, the value x occurs exactly x times in b. Find the minimum number of elements that need to be removed so that a will be a good sequence.

Constraints:
1 ≤ N ≤ 10^5
a_i is an integer.
1 ≤ a_i ≤ 10^9

Input:
Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_N

Output:
Print the minimum number of elements that need to be removed so that a will be a good sequence.

Sample Input 1:
4
3 3 3 3

Sample Output 1:
1
We can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.

Sample Input 2:
5
2 4 1 4 2

Sample Output 2:
2
We can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.

Sample Input 3:
6
1 2 2 3 3 3

Sample Output 3:
0

Sample Input 4:
1
1000000000

Sample Output 4:
1
Remove one occurrence of 10^9. Then, () is a good sequence.

Sample Input 5:
8
2 7 1 8 2 8 1 8

Sample Output 5:
5

# Buggy version:
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
ceil = math.ceil

n = ni()
A = lma()
co = collections.Counter(A)
ans = 0
for num,cnt in co.items():
    if num<cnt:
        ans+=(num-cnt)
    if num>cnt:
        ans+=cnt
print(ans)


# Fixed version:
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
ceil = math.ceil

n = ni()
A = lma()
co = collections.Counter(A)
ans = 0
for num,cnt in co.items():
    if num<cnt:
        ans+=(cnt-num)
    if num>cnt:
        ans+=cnt
print(ans)

# Buggy version:
n = len(input())
mp, res = {}, 0
for el in list(map(int, input().split())): mp[el] = mp.get(el, 0) + 1
for key, val in mp:
  if key > val: res += val
  elif key < val: res += val - key
print(res)

# Fixed version:
n = len(input())
mp, res = {}, 0
for el in list(map(int, input().split())): mp[el] = mp.get(el, 0) + 1
for key in mp:
    val = mp[key]
    if key > val: res += val
    elif key < val: res += val - key
print(res)

# Buggy version:
n = int(input())
arr = list(map(int,input().split()))
dicta={}
ans=0
for i in arr:
    dicta[i] = dicta.get(i,0)+1
for key,value in dicta.items():
    if key == value:
        continue
    else:
        diff = abs(key-value)
        ans+=diff

print(ans)

# Fixed version:
n = int(input())
arr = list(map(int,input().split()))
dicta={}
ans=0
for i in arr:
    dicta[i] = dicta.get(i,0)+1

for key,value in dicta.items():
    if key == value:
        continue
    elif key > value:
        ans+=value
    else:
        diff = abs(value-key)
        ans += diff

print(ans)

# Buggy version:
n = int(input())
a = list(map(int, input().split()))
dic = {}
for i in range(n):
  if a[i] in dic:
    dic[a[i]] += 1
  else:
    dic[a[i]] = 1
clear = 0
for k, v in dic.items():
  if k >= v:
    clear += v
  else:
    clear += v-k
print(clear)

# Fixed version:
n = int(input())
a = list(map(int, input().split()))
dic = {}
for i in range(n):
  if a[i] in dic:
    dic[a[i]] += 1
  else:
    dic[a[i]] = 1
clear = 0
for k, v in dic.items():
  if k > v:
    clear += v
  else:
    clear += v-k
print(clear)

# Buggy version:
hm={}
n=int(input())
ans=n
arr=[int(i) for i in input().split()]
for i in arr:
    hm[i]=hm.get(i,0)+1
print(hm)
for i in hm:
    if hm[i]!=i:
        if hm[i]>i:
            ans-=hm[i]-i
        else:
            ans-=hm[i]
print(n-ans)

# Fixed version:
hm={}
n=int(input())
ans=n
arr=[int(i) for i in input().split()]
for i in arr:
    hm[i]=hm.get(i,0)+1
for i in hm:
    if hm[i]!=i:
        if hm[i]>i:
            ans-=hm[i]-i
        else:
            ans-=hm[i]
print(n-ans)

# Buggy version:
n=int(input())
arr=list(map(int,input().split()))
d=dict()
count=0 
for i in arr:
    d[i]=d.get(i,0)+1 
print(d)
for k,v in d.items():
    if not d[k]==k:
        if d[k]<k:
            count+=d[k]
        else:
            count+=d[k]-k 
print(count)

# Fixed version:
n=int(input())
arr=list(map(int,input().split()))
d=dict()
count=0 
for i in arr:
    d[i]=d.get(i,0)+1 
for k,v in d.items():
    if not d[k]==k:
        if d[k]<k:
            count+=d[k]
        else:
            count+=d[k]-k 
print(count)

# Buggy version:
n = int(input())
a = list(map(int, input().split()))

occ = {}
for i in range(n):
    if a[i] not in occ:
        occ[a[i]] = 0
    occ[a[i]] += 1

res = 0
for x in occ:
    if (occ[x] < x):
        res += x
    else:
        res += occ[x] - x

print(res)

# Fixed version:
n = int(input())
a = list(map(int, input().split()))

occ = {}
for i in range(n):
    if a[i] not in occ:
        occ[a[i]] = 0
    occ[a[i]] += 1

res = 0
for x in occ:
    if (occ[x] < x):
        res += occ[x]
    else:
        res += occ[x] - x

print(res)

# Buggy version:
import collections

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

c = collections.Counter(A)
cs = sorted(c.items(), key=lambda x:x[0])
cnt = 0
for i in range(len(cs)):
    if(cs[i][0] != cs[i][1]):
        if(cs[i][0] < cs[i][1]):
            cnt += cs[i][1]-cs[i][0]
        else:
            cnt += cs[i][1]

if(N==1):
    print(0)
else:
    print(cnt)

# Fixed version:
import collections

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

c = collections.Counter(A)
cs = sorted(c.items(), key=lambda x:x[0])
cnt = 0
for i in range(len(cs)):
    if(cs[i][0] != cs[i][1]):
        if(cs[i][0] < cs[i][1]):
            cnt += cs[i][1]-cs[i][0]
        else:
            cnt += cs[i][1]
print(cnt)

# Buggy version:
n=int(input())
a=list(map(int,input().split()))
b=sorted(a)#n
c=[x for x in set(b) if b.count(x) > 0]
kosuu_list=[]
kosuu=1
for i in range(len(b)-1):
    #kosuu=0
    #print(b[i])
    if b[i]==b[i+1]:
        kosuu+=1
    else:
        kosuu_list.append(kosuu)
        kosuu=1
kosuu_list.append(b.count(b[-1]))

count=0
for i in range(len(c)):
    if kosuu_list[i]==c[i]:
        count+=0
    elif kosuu_list[i]>=c[i]:
        count+=kosuu_list[i]-c[i]
    else:
        count+=kosuu_list[i]
print(count)

# Fixed version:
n=int(input())
a=list(map(int,input().split()))
b=sorted(a)#n
c=list(set(b))
c.sort()
kosuu_list=[]
kosuu=1
for i in range(len(b)-1):
    #kosuu=0
    #print(b[i])
    if b[i]==b[i+1]:
        kosuu+=1
    else:
        kosuu_list.append(kosuu)
        kosuu=1
kosuu_list.append(b.count(b[-1]))
#print(kosuu_list)
count=0
#print(c)
for i in range(len(c)):
    if kosuu_list[i]==c[i]:
        count+=0
    elif kosuu_list[i]>=c[i]:
        count+=kosuu_list[i]-c[i]
    else:
        count+=kosuu_list[i]
print(count)

# Buggy version:
import collections
N = int(input())
a = list(map(int, input().split()))
a = collections.Counter(a)
a = a.most_common()
ans = 0
for i in range(len(a)):
  if a[i][0] >= a[i][1]:
    ans += a[i][0] - a[i][1]
  else:
    ans += a[i][1]
    
print(ans)

# Fixed version:
import collections
N = int(input())
a = list(map(int, input().split()))
a = collections.Counter(a)
a = a.most_common()
ans = 0
for i in range(len(a)):
  if a[i][0] <= a[i][1]:
    ans += a[i][1] - a[i][0]
  else:
    ans += a[i][1]
    
print(ans)

# Buggy version:
N=int(input().strip())
a=list(map(int, input().split()))
nlis={}

for i in range(N):
    if (a[i] in nlis)==False:
        nlis[a[i]]=1
    else:
        nlis[a[i]]+=1
ans=0
for i in nlis:
    if nlis[i]<i:
        ans+=i
    else:
        ans+=min(abs(nlis[i]-i),nlis[i])
print(ans)

# Fixed version:
N=int(input().strip())
a=list(map(int, input().split()))
nlis={}

for i in range(N):
    if (a[i] in nlis)==False:
        nlis[a[i]]=1
    else:
        nlis[a[i]]+=1
ans=0
for i in nlis:
    if nlis[i]<i:
        ans+=nlis[i]
    else:
        ans+=abs(nlis[i]-i)
    #print(ans)
print(ans)

# Buggy version:
N = int(input())
a = list(map(int, input().strip().split()))
a.sort()

i = 0
j = 1
ans = 0

for i in range(N-1):
	if a[i] == a[i+1]:
		j += 1
	else:
		if j >= a[i]:
			ans += j - a[i]
		else:
			ans += j
if a[N-1] != A[N-2]:
	if a[N-1] != 1:
		ans += 1
else:
	if j >= a[i]:
		ans += j - a[i]
	else:
		ans += j


# Fixed version:
N = int(input())
a = list(map(int, input().strip().split()))
a.sort()
i = 0
j = 1
ans = 0

for i in range(N-1):
	if a[i] == a[i+1]:
		j += 1
	else:
		if j >= a[i]:
			ans += j - a[i]
		else:
			ans += j
		j = 1
if a[N-1] != a[N-2]:
	if a[N-1] != 1:
		ans += 1
else:
	if j >= a[i]:
		ans += j - a[i]
	else:
		ans += j
print(ans)

# Buggy version:
N = int(input())
l = list(map(int, input().split()))
unique_l = list(set(l))
l.sort()
l.append(0)
ans = 0
j = 0
for i in unique_l:
    cnt = 0
    while l[j] == i and j < N:
        cnt += 1
        j += 1
    if cnt == i:
        pass
    elif cnt > i:
        ans += cnt - 1
    elif cnt < i:
        ans += cnt
print(ans)

# Fixed version:
N = int(input())
l = list(map(int, input().split()))
unique_l = list(set(l))
unique_l.sort()
l.sort()
l.append(0)
ans = 0
j = 0
cnt =[]
for i in unique_l:
    temp = 0
    while l[j] == i and j < N:
        temp += 1
        j += 1
    cnt.append(temp)
for i, j in zip(unique_l, cnt):
    if i == j:
        pass
    elif j > i:
        ans += j - i
    elif j < i:
        ans += j
print(ans)

# Buggy version:
from collections import Counter
n = input()
xs = [int(c) for c in input().split()]
c = Counter(xs)
ans = 0
for x, cnt in c.items():
  ans += cnt if x < cnt else (x - cnt)
print(ans)

# Fixed version:
from collections import Counter
n = input()
xs = [int(c) for c in input().split()]
c = Counter(xs)
ans = 0
for x, cnt in c.items():
  ans += cnt if cnt < x else (cnt - x)
print(ans)

# Buggy version:
length = input()
nums = input().split(" ")

numdict = {}
for i, num in enumerate(nums):
	if num not in numdict:
		numdict[str(num)] = 1
	else:
		numdict[str(num)] += 1

ret = 0
for k,v in numdict.items():
	if int(k) > int(v):
		ret += int(k) - int(v) 
	else:
		ret += int(v) - int(k)

print(ret)

# Fixed version:
length = input()
nums = input().split(" ")

numdict = {}
for i, num in enumerate(nums):
	if num not in numdict:
		numdict[str(num)] = 1
	else:
		numdict[str(num)] += 1

ret = 0
for k,v in numdict.items():
	if int(k) > int(v):
		ret += int(v) 
	else:
		ret += int(v) - int(k)

print(ret)

# Buggy version:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import random
import re
import string

N = int(input())
c = Counter(map(int, input().split()))
ans = 0
for k, v in c.items():
    if k < v:
        ans = v - k
    elif k > v:
        ans += v
print(ans)


# Fixed version:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import random
import re
import string

N = int(input())
c = Counter(map(int, input().split()))
ans = 0
for k, v in c.items():
    if k < v:
        ans += v - k
    elif k > v:
        ans += v
print(ans)

# Buggy version:
N=int(input())
a=[int(i) for i in input().split()]
data={}
for num in a:
    data[num]+=1
 
ans=0
for key in data.keys():
        if data[key]<key:
                ans+=data[key]
        else:
                ans+=data[key]-key
print(ans)

# Fixed version:
N=int(input())
a=[int(i) for i in input().split()]
data={}
for num in a:
        if num in data:
                data[num]+=1
        else:
                data[num]=1

ans=0
for key in data.keys():
        if data[key]<key:
                ans+=data[key]
        else:
                ans+=data[key]-key
print(ans)