Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline


N = int(input())
a_list = list(map(int, input().split()))
a_list_unique = list(set(a_list))
cnt = 0
for i in a_list_unique:
    a_dict = a_list.count(i)
    if i <= a_dict:
        cnt +=  a_dict - i
    else:
        cnt += a_dict
print(cnt)

Fixed submission:
import sys
input = sys.stdin.readline
from collections import Counter


N = int(input())
a_list = list(map(int, input().split()))
a_list_unique = list(set(a_list))
a_cnt = Counter(a_list)
cnt = 0
for i in a_list_unique:
    a_dict = a_cnt[i]
    if i <= a_dict:
        cnt +=  a_dict - i
    else:
        cnt += a_dict
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline


N = int(input())
a_list = list(map(int, input().split()))
a_list_unique = list(set(a_list))
cnt = 0
a_dict = {}
for i in a_list_unique:
    a_dict[i] = a_list.count(i)
    if i <= a_dict[i]:
        cnt +=  a_dict[i] - i
    else:
        cnt += a_dict[i]
print(cnt)

Fixed submission:
import sys
input = sys.stdin.readline
from collections import Counter


N = int(input())
a_list = list(map(int, input().split()))
a_list_unique = list(set(a_list))
a_cnt = Counter(a_list)
cnt = 0
for i in a_list_unique:
    a_dict = a_cnt[i]
    if i <= a_dict:
        cnt +=  a_dict - i
    else:
        cnt += a_dict
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a_list = list(map(int, input().split()))
a_list_unique = list(set(a_list))
cnt = 0
a_dict = {}
for i in a_list_unique:
    a_dict[i] = a_list.count(i)
    if i <= a_dict[i]:
        cnt +=  a_dict[i] - i
    else:
        cnt += a_dict[i]
print(cnt)

Fixed submission:
import sys
input = sys.stdin.readline
from collections import Counter


N = int(input())
a_list = list(map(int, input().split()))
a_list_unique = list(set(a_list))
a_cnt = Counter(a_list)
cnt = 0
for i in a_list_unique:
    a_dict = a_cnt[i]
    if i <= a_dict:
        cnt +=  a_dict - i
    else:
        cnt += a_dict
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a_list = list(map(int, input().split()))
a_list.sort()
cnt = 0
for i in range(N):
    if a_list[i] > N:
        cnt += len(a_list[i:])
        break
for i in range(1, N+1):
    if a_list.count(i) > i:
        cnt += a_list.count(i) - i
    elif a_list.count(i) < i:
        cnt += a_list.count(i)
    else:
        pass
print(cnt)

Fixed submission:
import sys
input = sys.stdin.readline
from collections import Counter


N = int(input())
a_list = list(map(int, input().split()))
a_list_unique = list(set(a_list))
a_cnt = Counter(a_list)
cnt = 0
for i in a_list_unique:
    a_dict = a_cnt[i]
    if i <= a_dict:
        cnt +=  a_dict - i
    else:
        cnt += a_dict
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a_list = list(map(int, input().split()))
a_list.sort()
cnt = 0
for i in range(N):
    if a_list[i] > N:
        cnt += 1
for i in range(1, N+1):
    if a_list.count(i) > i:
        cnt += a_list.count(i) - i
    elif a_list.count(i) < i:
        cnt += a_list.count(i)
    else:
        pass
print(cnt)

Fixed submission:
import sys
input = sys.stdin.readline
from collections import Counter


N = int(input())
a_list = list(map(int, input().split()))
a_list_unique = list(set(a_list))
a_cnt = Counter(a_list)
cnt = 0
for i in a_list_unique:
    a_dict = a_cnt[i]
    if i <= a_dict:
        cnt +=  a_dict - i
    else:
        cnt += a_dict
print(cnt)