CodeEff/ECCO huggingface dataset:
# Original solution
N=int(eval(input()))
L=['a','b','c','d','e','f','g','h','i','j']

A = [L[0]]
B = [A[0]+L[i] for i in range(2)]
C = [i+L[j] for i in B for j in range(len(set(i))+1)]
D = [i+L[j] for i in C for j in range(len(set(i))+1)]
E = [i+L[j] for i in D for j in range(len(set(i))+1)]
F = [i+L[j] for i in E for j in range(len(set(i))+1)]
G = [i+L[j] for i in F for j in range(len(set(i))+1)]
H = [i+L[j] for i in G for j in range(len(set(i))+1)]
I = [i+L[j] for i in H for j in range(len(set(i))+1)]
J = [i+L[j] for i in I for j in range(len(set(i))+1)]

Z = [A,B,C,D,E,F,G,H,I,J]

for i in Z[N-1]:
    print(i)

# Optimized solution
N=int(eval(input()))
L=['a','b','c','d','e','f','g','h','i','j']

Ans = [L[0]]
Backup = []

for k in range(N-1):
    Backup = Ans
    Ans = [i+L[j] for i in Backup for j in range(len(set(i))+1)]

for i in Ans:
    print(i)
# Original solution
def DFS(word,n):
    if len(word)==N:
        return print(word)
    else:
        for i in range(n+1):
            DFS(word+chr(97+i),n+1 if i==n else n)


N=int(input())
DFS("",0)


# Optimized solution
def DFS(word,N):
    if len(word)==n:
        return print(word)
    else:
        for i in range(N+1):
            DFS(word+chr(97+i),N+1 if i==N else N)


n=int(input())
DFS("",0)
# Original solution
def f(word,N):
    if len(word)==n:
        return print(word)
    else:
        for i in range(N+1):
            f(word+chr(97+i),N+1 if i==N else N)


n=int(input())
f("",0)


# Optimized solution
def f(word,n):
    if len(word)==N:return print(word)
    else:
        for i in range(n+1):
            f(word+chr(97+i),n+1 if i==n else n)


N=int(input())
f("",0)
# Original solution
n = int(input())
anstmp = ["a"]
cnt = 0
for i in anstmp:
  t = ord(i[-1])-95
  if cnt > 1000000:
    break
  for j in range(1,t+1):
    anstmp.append(i+chr(j+96))
  cnt += 1
ans = set()
for i in anstmp:
  if len(i) == n:
    ans.add(i)
ans = list(ans)
ans.sort()
print(*ans,sep="\n")


# Optimized solution
n = int(input())
anstmp = ["a"]
cnt = 0
for i in anstmp:
  t = max(ord(k) for k in i)-95
  if cnt > 100000:
    break
  for j in range(1,t+1):
    anstmp.append(i+chr(j+96))
  cnt += 1
ans = set()
for i in anstmp:
  if len(i) == n:
    ans.add(i)
ans = list(ans)
ans.sort()
print(*ans,sep="\n")
# Original solution
n = int(eval(input()))

d = 'abcdefghijklm'


def conv(s):
    s = list([d[x] for x in s])
    return ''.join(s)


def dfs(s):
    if len(s) == n:
        print((conv(s)))
    else:
        mx = max(s)+1
        for i in range(mx+1):
            dfs(s+[i])


dfs([0])

# Optimized solution
n = int(eval(input()))

d = 'abcdefghijklm'


def conv(s):
    s = list([d[x] for x in s])
    return ''.join(s)


def dfs(s, k):
    if len(s) == n:
        print(s)
    else:
        for i in range(k):
            dfs(s+d[i], k)
        dfs(s+d[k], k+1)


dfs('a', 1)
# Original solution
n = int(eval(input()))
s = "abcdefghij"

class Node:
    __slots__ = ["string", "index"]
    def __init__(self, string, index):
        self.string = string
        self.index = index

    def get_children(self):
        parent = self.string
        out = [None]*(self.index+1)
        for i, c in enumerate(s[:self.index]):
            out[i] = Node(parent+c, self.index)
        out[i+1] = Node(parent+s[self.index], self.index+1)
        return out

root = Node("a", 1)
children = [root]
for _ in range(n-1):
    parents, children = children, []
    for parent in parents:
        children.extend(parent.get_children())
for child in children:
    print((child.string))

# Optimized solution
class Node:
    __slots__ = ["string", "index"]
    def __init__(self, string, index):
        self.string = string
        self.index = index

    def get_children(self):
        s = "abcdefghij"
        parent = self.string
        out = [None]*(self.index+1)
        for i, c in enumerate(s[:self.index]):
            out[i] = Node(parent+c, self.index)
        out[i+1] = Node(parent+s[self.index], self.index+1)
        return out

def main():
    n = int(eval(input()))
    root = Node("a", 1)
    children = [root]
    for _ in range(n-1):
        parents, children = children, []
        for parent in parents:
            children.extend(parent.get_children())
    for child in children:
        print((child.string))

if __name__ == "__main__":
    main()
# Original solution
class Node:
    __slots__ = ["string", "index"]
    def __init__(self, string, index):
        self.string = string
        self.index = index

    def get_children(self):
        parent = self.string
        out = [None]*(self.index+1)
        for i, c in enumerate(s[:self.index]):
            out[i] = Node(parent+c, self.index)
        out[i+1] = Node(parent+s[self.index], self.index+1)
        return out

def main():
    n = int(eval(input()))
    root = Node("a", 1)
    children = [root]
    for _ in range(n-1):
        parents, children = children, []
        for parent in parents:
            children.extend(parent.get_children())
    for child in children:
        print((child.string))

if __name__ == "__main__":
    s = "abcdefghij"
    main()

# Optimized solution
def dfs(s, mx):
    if len(s) == n:
        print(s)
        return
    for c in a[:mx]:
        dfs(s+c, mx)
    dfs(s+a[mx], mx+1)

n = int(eval(input()))
a = "abcdefghij"
dfs("", 0)
# Original solution
N = int(input())
strlist = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']


ans = [['a']]
for i in range(1, N):
  ans.append([])
  for s in ans[i-1]:
    n = len(set(s))
    for j in range(n+1):
      ans[i].append(s+strlist[j])

# ans.sort()
print(*ans[-1], sep='\n')


# Optimized solution
N = int(input())
strlist = 'abcdefghij'

ans = [['a']]
for i in range(1, N):
  ans.append([])
  for s in ans[i-1]:
    n = ord(max(s)) - 96
    for j in range(n+1):
      ans[i].append(s+strlist[j])

print(*ans[-1], sep='\n')
# Original solution
import sys
from collections import deque

input = sys.stdin.readline


def dfs(N):
    alphabet = "abcdefghij"
    stack = deque(["a"])
    while stack:
        s = stack.pop()
        if len(s) == N:
            print(s)
            continue
        suffixes = []
        for al in alphabet:
            suffixes.append(al)
            if al not in s:
                break
        for suffix in reversed(suffixes):
            stack.append("".join((s, suffix)))


def main():
    N = int(eval(input()))

    dfs(N)


if __name__ == "__main__":
    main()


# Optimized solution
import sys
from collections import deque

input = sys.stdin.readline


def dfs(N):
    alphabet = "abcdefghij"
    stack = deque(["a"])
    while stack:
        s = stack.pop()
        if len(s) == N:
            print(s)
            continue
        for suffix in reversed(alphabet[:len(set(s)) + 1]):
            stack.append("".join((s, suffix)))


def main():
    N = int(eval(input()))

    dfs(N)


if __name__ == "__main__":
    main()
# Original solution
import sys
from collections import deque

input = sys.stdin.readline


def dfs(N):
    alphabet = "abcdefghij"
    stack = deque(["a"])
    while stack:
        s = stack.pop()
        if len(s) == N:
            print(s)
            continue
        for suffix in reversed(alphabet[:len(set(s)) + 1]):
            stack.append("".join((s, suffix)))


def main():
    N = int(eval(input()))

    dfs(N)


if __name__ == "__main__":
    main()


# Optimized solution
import sys
from collections import deque

input = sys.stdin.readline


def dfs(N):
    alphabet = "abcdefghij"
    stack = deque(["a"])
    ans = []
    while stack:
        s = stack.pop()
        if len(s) == N:
            ans.append(s)
            continue
        for suffix in reversed(alphabet[:len(set(s)) + 1]):
            stack.append("".join((s, suffix)))
    return ans


def main():
    N = int(eval(input()))

    ans = dfs(N)
    print(("\n".join(ans)))


if __name__ == "__main__":
    main()
# Original solution
n = int(input())
ans = []
start = ("a", 1, ord("a"))
stack = []
stack.append(start)
num = ord("a")
while stack:
    v, nagasa, mx = stack.pop()
    if nagasa == n:
        ans.append(v)
        continue
    for i in range(num, mx + 2):
        tuika = chr(i)
        mx = max(i, mx)
        stack.append((v + tuika, nagasa + 1, mx))
print(*ans[::-1], sep="\n")


# Optimized solution
n = int(input())
ans = []
start = "a"
stack = []
stack.append(start)
num = ord("a")
while stack:
    v = stack.pop()
    if len(v) == n:
        ans.append(v)
        continue
    s = list(v[::])
    s.sort()
    nex_num = ord(s[-1])
    for i in range(num, nex_num + 2):
        tuika = chr(i)
        stack.append(v + tuika)
print(*ans[::-1], sep="\n")
# Original solution
# Panasonic2020 D - String Equivalence
def generator(n):
    if n == 1:
        yield [0]
    else:
        for A in generator(n - 1):
            for i in range(max(A) + 2):
                A.append(i)
                yield A
                A.pop()


n = int(eval(input()))
for A in generator(n):
    s = ''
    for a in A:
        s += chr(a + 97)
    print(s)


# Optimized solution
def generator(n):
    if n == 1:
        yield [0]
    else:
        for A in generator(n - 1):
            for i in range(max(A) + 2):
                A.append(i)
                yield A
                A.pop()


n = int(eval(input()))
for A in generator(n):
    print((''.join([chr(a + 97) for a in A])))
# Original solution
from collections import Counter
eval(input());a=Counter(list(map(int,input().split())))
print((sum([j if i>j else j-i for i,j in list(a.items())])))

# Optimized solution
from collections import Counter
eval(input());print((sum(j if i>j else j-i for i,j in list(Counter(list(map(int,input().split()))).items()))))
# Original solution
import math
import collections
from sys import exit
from itertools import product

ii = lambda : int(eval(input()))
mi = lambda : list(map(int,input().split()))
li = lambda : list(map(int,input().split()))

n = ii()
a = li()

sa = set(a)

ans = 0
for i in sa:
    tmp = a.count(i)
    if tmp < i:
        ans += tmp
    else:
        ans += tmp - i
print(ans)

# Optimized solution
import math
from collections import Counter
from sys import exit
from itertools import product

ii = lambda : int(eval(input()))
mi = lambda : list(map(int,input().split()))
li = lambda : list(map(int,input().split()))

n = ii()
a = li()

cnt = Counter(a)
ans = 0
for i,j in list(cnt.items()):
    if i > j:
        ans += j
    else:
        ans += j - i
print(ans)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))

ans = 0
for i in set(a):
  c = a.count(i)
  if c >= i:
    ans += c - i
  else:
    ans += c
print(ans)

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))

ans = 0
for i in set(a):
  if i <= n:
    c = a.count(i)
    if c >= i:
      ans += i
print((n - ans))
# Original solution
#!/usr/bin/env python3
import sys
import collections

def solve(N: int, a: "List[int]"):
    counter = collections.Counter(a)
    aset = set(a)
    answer = 0
    for aa in aset:
        answer += (counter[aa]-aa) if counter[aa]>=aa else counter[aa]
    print(answer)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python3
import sys
from collections import Counter

def solve(N: int, a: "List[int]"):
    counter = Counter(a)
    answer = 0
    for key,value in list(counter.items()):
        if key >value:
            answer += value
        else:
            answer += value-key
    print(answer)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()
# Original solution
from collections import Counter
N = int(eval(input()))
a = [int(i) for i in input().split()]
b = Counter(a)
ans = 0
for x in b:
    if b[x] > x:
        ans += b[x] - x
    elif b[x] < x:
        ans += b[x]
print(ans)

# Optimized solution
from collections import Counter
N = int(eval(input()))
a = [int(i) for i in input().split()]

ans = 0
m = Counter(a)
for x, y in list(m.items()):
    if x == y:
        continue
    elif x < y:
        ans += abs(y-x)
    else:
        ans += y
print(ans)
# Original solution
n=eval(input())
a=list(map(int,input().split()))
a.sort()
#print(a)
i=0
ans=0
while i!=len(a):
    x=a[i]
    x1=a.count(x)
    if x<x1:
        ans=ans+x1-x
    elif x>x1:
        ans=ans+x1
    else:
        pass
    i=i+x1
print(ans)

# Optimized solution
n=eval(input())
a=list(map(int,input().split()))
a.sort()
#print(a)
i=0
ans=0
while i!=len(a):
    x=a[i]
    x1=a.count(x)
    if (x>len(a)-i):
        ans=ans+len(a)-i
        break
    else:

        if x<x1:
            ans=ans+x1-x
        elif x>x1:
            ans=ans+x1
        else:
            pass
        i=i+x1
print(ans)
# Original solution
n = int(eval(input()))
a_list = list(map(int, input().split()))
dic = {}
i_list = []
for a in a_list:
    dic[a] = 0
for a in a_list:
    dic[a] += 1
for i in a_list:
    if i not in i_list:
        i_list.append(i)
ans = 0
for i in i_list:
    p = dic[i] - i 
    if p >= 0:
        ans += p
    else:
        ans += dic[i]
print(ans)

# Optimized solution
n = int(eval(input()))
a_list = list(map(int, input().split()))
dic = {}
i_list = []
for a in a_list:
    dic[a] = 0
for a in a_list:
    dic[a] += 1
    if dic[a] == 1:
        i_list.append(a)
ans = 0
for i in i_list:
    p = dic[i] - i 
    if p >= 0:
        ans += p
    else:
        ans += dic[i]
print(ans)
# Original solution
N=int(eval(input()))
s=list(map(int,input().split()))
t=list(set(s))
ans=0
for i in range(len(t)):
    u=s.count(t[i])-t[i]
    if u<0:
        ans+=s.count(t[i])
    if u>0:
        ans+=u
print(ans)   

# Optimized solution
N=int(eval(input()))
s,ans={},0
for i in list(map(int,input().split())):
    s[i]=s.get(i,0)+1
for c,v in list(s.items()):
    if c<v:
        ans+=v-c
    if c>v:
        ans+=v
print(ans)
# Original solution
from collections import Counter
n = eval(input())
c = Counter(list(map(int, input().split())))
print((sum(0 if c[key] == key else c[key] if c[key] < key else c[key] - key for key in c)))


# Optimized solution
from collections import Counter
n = eval(input())
c = Counter(list(map(int, input().split())))
print((sum(v if v < k else v - k for k,v in list(c.items()))))
# Original solution
from collections import Counter
N, *a = list(map(int, open(0).read().split()))
c = Counter(a)
ans = 0
for v in c:
  if v > c[v]:
    ans += c[v]
  else:
    ans += c[v] - v
print(ans)


# Optimized solution
from collections import Counter
N, *a = list(map(int, open(0).read().split()))
c = Counter(a)
print((sum(c[v] if v > c[v] else c[v] - v for v in c)))
# Original solution
def C_Good_Sequence():
    N=int(eval(input()))
    a=list(map(int, input().split()))
    b=set(a)
    b=list(b)
    count=0
    ans=0 
    c=[]
    
    for i in b:
        for j in range(N):
            if a[j]==i:
                count += 1
        c.append(count)
        count=0

    for i in range(len(b)):
        if c[i]<b[i]:
            ans += c[i]
        elif c[i] >b[i]:
            ans += c[i]-b[i]
    print(ans)
   
C_Good_Sequence()

# Optimized solution
def C_Good_Sequence():
    N=int(eval(input()))
    a=list(map(int, input().split()))
    count={}
    ans=0
    
    for num in a:
        count[num]= count.get(num,0)+1

    for num in count:
        if num > count[num]:
            ans += count[num]
        elif num < count[num]:
            ans += count[num]-num
    
    print(ans)
   
C_Good_Sequence()
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))

import collections

ac = collections.Counter(a)
common = ac.most_common()

operation_count = 0
for num, num_count in common:
  if num < num_count:
    operation_count += num_count - num
  elif num_count < num:
    operation_count += num_count

print(operation_count)
    

# Optimized solution
n = int(eval(input()))
import collections

a = list(map(int, input().split()))
ac = collections.Counter(a)

la = len(a)
ans = 0
for k, c in list(ac.items()):
  if c < k:
    ans += c
  else:
    ans += c - k
    
print(ans)
# Original solution
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)

# Optimized solution
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)
# Original solution
n = int(eval(input()))
arr = []
out = {}

input = input().split(" ")
for i in input:
	arr.append(int(i))
	
	if out.get(arr[-1], False):
		out[arr[-1]] += 1
	else:
		out[arr[-1]] = 1

count = 0
for key in out:
	if key > out[key]:
		count += out[key]
	else:
		count += out[key] - key

print(count)

# Optimized solution
N = int(eval(input()))
seq = list(map(int, input().split()))

d = {}
for i in range(0,N):
    e = seq[i]
    if e not in list(d.keys()):
        d[e] = 1
    else:
        d[e] += 1

r = 0
for k in list(d.keys()):
    v = d[k]
    if (v < k):
        r += v
    else:
        r += v-k

print(r)
# Original solution
import sys
from collections import Counter


input = sys.stdin.readline


def main():
    N = int(eval(input()))
    A = [int(x) for x in input().split()]

    C = Counter(A)

    ans = 0
    for k in list(C.keys()):
        if k > C[k]:
            ans += C[k]
        else:
            ans += C[k] - k
    print(ans)


    
    

if __name__ == '__main__':
    main()



# Optimized solution
import collections


N = int(eval(input()))
A = [int(x) for x in input().split()]

c = collections.Counter(A)

ans = 0
for k in list(c.keys()):
    if k <= c[k]:
        ans += c[k] - k
    else:
        ans += c[k]

print(ans)
# Original solution
b = []
count = []
def sarch(num):
    for i in range(len(b)):
        if num == b[i]:
            return i
    b.append(num)
    count.append(0)
    return len(b) - 1
    
N = eval(input())
a = list(map(int, input().split()))
ans = 0
for i in range(len(a)):
    if a[i] != 0:
        count[sarch(a[i])] += 1
for i in range(len(count)):
    if b[i] > count[i]:
        ans += count[i]
    elif b[i] < count[i]:
        ans += (count[i] - b[i])
print(ans)


# Optimized solution
N = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
i = 1
cnt = 1
key = a[0]
ans = 0
while True:
    if i >= len(a):
        break
    if key == a[i]:
        cnt += 1
    else:
        if key != cnt:
            if cnt > key:
                ans += cnt - key
            else:
                ans += cnt
        cnt = 1
        key = a[i]
    
    i += 1

if key != cnt:
    if cnt > key:
        ans += cnt - key
    else:
        ans += cnt

print(ans)
# Original solution
N=int(eval(input()))
A=list(map(int,input().split()))
A.sort()
from collections import Counter
A=Counter(A)
ret=0
for i in A.most_common():
  if i[0]>i[1]:
    ret+=i[1]
  else:
    ret+=i[1]-i[0]
print(ret)

# Optimized solution
N=int(eval(input()))
A=list(map(int,input().split()))
from collections import Counter
A=Counter(A)
ret=0
for i in A.most_common():
  if i[0]>i[1]:
    ret+=i[1]
  else:
    ret+=i[1]-i[0]
print(ret)
# Original solution
import collections
n = int(eval(input()))
a = list(map(int, input().split()))
aa = collections.Counter(a)
ans = 0
for i,j in sorted(aa.items()):
	if j > i:
		ans += j-i
	elif j < i:
		ans += j
print (ans)


# Optimized solution
from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))

c = Counter(a)
ans = 0
for i in c:
	if c[i] > i:
		ans += c[i] - i
	elif c[i] < i:
		ans += c[i]
print (ans)
# Original solution
eval(input())
from collections import *
c=Counter(list(map(int,input().split())))
print((sum(v-k*(k<=v) for k,v in list(c.items()))))

# Optimized solution
from collections import*;eval(input());print((sum(v-k*(k<=v)for k,v in list(Counter(list(map(int,input().split()))).items()))))
# Original solution
import collections

num = int(eval(input()))
val = [int(x) for x in input().split()]

cnt = collections.Counter(val)
res = 0
for x in cnt:
    if cnt[x] > x:
        res += cnt[x] - x
    elif cnt[x] < x:
        res += cnt[x]

print(res)

# Optimized solution
import collections

n = int(eval(input()))
array = [int(x) for x in input().split()]
_dict = collections.Counter(array)

res = 0
for i, j in list(_dict.items()):
    if i != j:
        if i > j:
            res += j
        else:
            res += abs(i-j)
print(res)
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
set_a=set(a)
import collections
count=0
data=collections.Counter(a)
for i,j in list(data.items()):
    if i<j:
        count+=j-i
    elif j<i:
        count+=j
print(count)

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
from collections import Counter
data=Counter(a)
ans=0
for i,j in list(data.items()):
    if i<j:
        ans+=j-i
    elif j<i:
        ans+=j
print(ans)
# Original solution
N = int(eval(input()))
a = list(map(int,input().split()))
A = list(set(a))
c = 0
ac = 0
for i in range(len(A)):
    ac = a.count(A[i])
    if ac >= A[i]:
        c += ac - A[i]
    elif ac > 0:
        c += ac
print(c)


# Optimized solution
N = int(eval(input()))
a = list(map(int, input().split()))
if N == 1:
    if a[0] != 1:
        print((1))
        exit()
    else:
        print((0))
        exit()
a.sort()
A = 0
c = 0
while True:
    try:
        #print(a)
        A = a[0]
        if len(a)>1:
            for i in range(1, len(a)):
                if a[i] != A:
                    # print(i + 1)
                    # c += i
                    del a[:i]
                    if i >= A:
                        c += i - A
                    else:
                        c += i
                    # print(a[i], c)
                    break
                elif i == len(a) - 1:
                    if i + 1 >= A:
                        c += i + 1 - A
                    else:
                        c += i + 1
                    print(c)
                    exit()
        else:
            print((c + 1))
            exit()
    except IndexError:
        break
# Original solution
N=int(eval(input()))
a=list(map(int,input().split()))

dic={}
keylist=list(set(a))
cnt=0
for i in range(len(keylist)):
    serchingnum=keylist[i]
    num=a.count(serchingnum)
    if num>=serchingnum:
        cnt+=num-serchingnum
    else:
        cnt+=num
print(cnt)


# Optimized solution
N=int(eval(input()))
a=list(map(int,input().split()))

cnt=0
counterarr=[0 for _ in range(N)]
others=[]
for i in range(N):
    if a[i]-1<N:
        counterarr[a[i]-1]+=1
    else:
        others.append(a[i])
for i in range(N):
    shoudbe=i+1
    now=counterarr[i]
    if shoudbe>now:
        cnt+=now
    elif shoudbe<now:
        cnt+=now-shoudbe
cnt+=len(others)
print(cnt)
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))
b = set(a)
b = list(b)
x = [0 for i in range(len(b))]
for i in a:
    y = b.index(i)
    x[y] += 1
ans = 0
for i,j in zip(b,x):
    if j < i:
        ans += j
    else:
        ans += j - i
print(ans)

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
a.sort()
count = 0
x = 0
tmp_count = 0
for i in a:
    if i != x:
        if tmp_count < x:
            count += tmp_count
        else:
            count += tmp_count - x
        tmp_count = 1
        x = i
    else:
        tmp_count += 1
if tmp_count < x:
    count += tmp_count
else:
    count += tmp_count - x
print(count)