Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(map(int,input().split()))
t = {}
o = 0
for i in range(n):
    if s[i] not in t.keys():
        t[s[i]] = 1
    else:
        t[s[i]] += 1

for i,j in t.items():
    if i > j:
        o += j
    else:
        o += j - i

print(o)

Fixed submission:
n = int(input())
s = list(map(int,input().split()))
t = {}
o = 0
for i in range(n):
    if s[i] not in t.keys():
        t[s[i]] = 1
    else:
        t[s[i]] += 1

for i,j in t.items():
    if i > j:
        o += j
    else:
        o += j - i

print(o)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(map(int,input().split()))
t = []
r = []
m = []
o = 0
for i in range(n):
    if s[i] not in t:
        t.append(s[i])
        r.append(1)
        m.append(0)
    else:
        r[t.index(s[i])] += 1
    
    p = t.index(s[i])
    if r[p] - t[p] >= 0 and m[p] == 0:
        m[p] = 1
        r[p] -= t[p]

print(sum(r))

Fixed submission:
n = int(input())
s = list(map(int,input().split()))
t = {}
o = 0
for i in range(n):
    if s[i] not in t.keys():
        t[s[i]] = 1
    else:
        t[s[i]] += 1

for i,j in t.items():
    if i > j:
        o += j
    else:
        o += j - i

print(o)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
s = list(map(int,input().split()))
s1 = np.array(s)
t,r = np.array([]),np.array([])
o = 0
for i in range(n):
    if s[i] not in t:
        t = np.append(t,s[i])
        r = np.append(r,1)
    else:
        p = np.where(t == s[i])
        r[p] += 1

for i in range(len(t)):
    q = r[i] - t[i]
    if q >= 0:
        o += q
    else:
        o += r[i]

print(int(o))

Fixed submission:
n = int(input())
s = list(map(int,input().split()))
t = {}
o = 0
for i in range(n):
    if s[i] not in t.keys():
        t[s[i]] = 1
    else:
        t[s[i]] += 1

for i,j in t.items():
    if i > j:
        o += j
    else:
        o += j - i

print(o)

Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
s = list(map(int,input().split()))
s1 = np.array(s)
t,r = np.array([]),np.array([])
o = 0
for i in range(n):
    if s[i] not in t:
        t = np.append(t,s[i])
        r = np.append(r,1)
    else:
        p = np.where(t == s[i])
        r[p] += 1

for i in range(len(t)):
    q = r[i] - t[i]
    if q >= 0:
        o += q
    else:
        o += r[i]

print(int(o))

Fixed submission:
n = int(input())
s = list(map(int,input().split()))
t = {}
o = 0
for i in range(n):
    if s[i] not in t.keys():
        t[s[i]] = 1
    else:
        t[s[i]] += 1

for i,j in t.items():
    if i > j:
        o += j
    else:
        o += j - i

print(o)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(map(int,input().split()))
t = []
r = []
o = 0
for i in range(n):
    if s[i] not in t:
        t.append(s[i])
        r.append(1)
    else:
        p = t.index(s[i])
        r[p] += 1

for i in range(len(t)):
    q = r[i] - t[i]
    if q >= 0:
        o += q
    else:
        o += r[i]

print(o)

Fixed submission:
n = int(input())
s = list(map(int,input().split()))
t = {}
o = 0
for i in range(n):
    if s[i] not in t.keys():
        t[s[i]] = 1
    else:
        t[s[i]] += 1

for i,j in t.items():
    if i > j:
        o += j
    else:
        o += j - i

print(o)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(map(int,input().split()))
t = []
r = []
o = 0
for i in range(n):
    if s[i] not in t:
        t.append(s[i])
        r.append(1)
    else:
        p = t.index(s[i])
        r[p] += 1

for i in range(len(t)):
    q = r[i] - t[i]
    if q >= 0:
        o += q
    else:
        o += r[i]

print(o)

Fixed submission:
n = int(input())
s = list(map(int,input().split()))
t = {}
o = 0
for i in range(n):
    if s[i] not in t.keys():
        t[s[i]] = 1
    else:
        t[s[i]] += 1

for i,j in t.items():
    if i > j:
        o += j
    else:
        o += j - i

print(o)