Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
N, M = map(int, input().split())

p_list = []
S_list = []
ac_list = []
wa_list = [0 for i in range(N)]
for i in range(M):
    p, S = map(str, input().split())
    p = int(p)
    if p not in ac_list:
        if S == "AC":
            ac_list.append(p)
        else:
            wa_list[p - 1] += 1

wa_num = 0
for i in range(len(ac_list)):
    wa_num += wa_list[ac_list[i] - 1]
print("{} {}".format(len(ac_list), wa_num))

Fixed submission:
# -*- coding: utf-8 -*-
N, M = map(int, input().split())

p_list = []
S_list = []
ac_set = set([])
wa_list = [0 for i in range(N)]
for i in range(M):
    p, S = map(str, input().split())
    p = int(p)
    if p not in ac_set:
        if S == "AC":
            ac_set.add(p)
        else:
            wa_list[p - 1] += 1

wa_num = 0
for i in ac_set:
    wa_num += wa_list[i - 1]
print("{} {}".format(len(ac_set), wa_num))
Buggy python submission (verdict: Runtime Error):
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix

H, W = map(int, input().split())

graph_list = []
for i in range(H):
    temp_graph_str = str(input())
    temp_list = [1 if i == "." else 0 for i in temp_graph_str]
    graph_list.append(temp_list)

graph_tree_list = []
for i in range(H):
    for j in range(W):
        temp_list = [0 for x in range(H * W)]
        if graph_list[i][j] == 1:
            if i > 0:
                if graph_list[i - 1][j] == 1:
                    temp_list[(i - 1) * W + j] = 1
            if i < H - 1:
                if graph_list[i + 1][j] == 1:
                    temp_list[(i + 1) * W + j] = 1
            if j > 0:
                if graph_list[i][j - 1] == 1:
                    temp_list[i * W + (j - 1)] = 1
            if j < H - 1:
                if graph_list[i][j + 1] == 1:
                    temp_list[i * W + (j + 1)] = 1
        graph_tree_list.append(temp_list)

graph_tree_array = np.array(graph_tree_list)

sp = shortest_path(graph_tree_array, directed=False, unweighted=True)

# print(sp)
sp[np.isinf(sp)] = 0
print(int(np.max(sp)))

Fixed submission:
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix

H, W = map(int, input().split())

graph_list = []
for i in range(H):
    temp_graph_str = str(input())
    temp_list = [1 if i == "." else 0 for i in temp_graph_str]
    graph_list.append(temp_list)

graph_tree_list = []
for i in range(H):
    for j in range(W):
        temp_list = [0 for x in range(H * W)]
        if graph_list[i][j] == 1:
            if i > 0:
                if graph_list[i - 1][j] == 1:
                    temp_list[(i - 1) * W + j] = 1
            if i < H - 1:
                if graph_list[i + 1][j] == 1:
                    temp_list[(i + 1) * W + j] = 1
            if j > 0:
                if graph_list[i][j - 1] == 1:
                    temp_list[i * W + (j - 1)] = 1
            if j < W - 1:
                if graph_list[i][j + 1] == 1:
                    temp_list[i * W + (j + 1)] = 1
        graph_tree_list.append(temp_list)

graph_tree_array = np.array(graph_tree_list)

sp = shortest_path(graph_tree_array, directed=False, unweighted=True)

# print(sp)
sp[np.isinf(sp)] = 0
print(int(np.max(sp)))
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
N, M, V, P = map(int, input().split())
A_list = list(map(int, input().split()))

A_list.sort(reverse = True)
# print(A_list)
ans = P
border = A_list[P - 1]

if P < N:
    before_A = border
    for i in range(P, N):
        if before_A == A_list[i]:
            ans += 1
#             print(1, i, A_list[i])
        elif border <= (A_list[i] + M):
            over_V = V - (P + N - (i + 1))
            if over_V > 0:
                sum_over = sum(A_list[P - 1:i]) + over_V * M
                round_up_sum_over = -(-sum_over // (i + 1 - P))
                if A_list[i] + M >= round_up_sum_over:
                    ans += 1
#                     print(2, i, A_list[i], round_up_sum_over, over_V, sum_over)
                else:
#                     print("NG", i, A_list[i], round_up_sum_over, over_V)
                    break
            else:
                ans += 1
#                 print(3, i, A_list[i])
            before_A = A_list[i]
        else:
            break
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
N, M, V, P = map(int, input().split())
A_list = list(map(int, input().split()))

A_list.sort(reverse = True)
# print(A_list)
ans = P
border = A_list[P - 1]
sum_over_A = border

if P < N:
    before_A = border
    for i in range(P, N):
        if before_A == A_list[i]:
            ans += 1
#             print(1, i, A_list[i])
        elif border <= (A_list[i] + M):
            over_V = V - (P + N - (i + 1))
            if over_V > 0:
                sum_over = sum_over_A + over_V * M
                round_up_sum_over = -(-sum_over // (i + 1 - P))
                if A_list[i] + M >= round_up_sum_over:
                    ans += 1
#                     print(2, i, A_list[i], round_up_sum_over, over_V, sum_over)
                else:
#                     print("NG", i, A_list[i], round_up_sum_over, over_V)
                    break
            else:
                ans += 1
#                 print(3, i, A_list[i])
            before_A = A_list[i]
        else:
            break
        sum_over_A += A_list[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A, B = map(int, input().split())

print(lcm(A, B))

Fixed submission:
# -*- coding: utf-8 -*-
# lcm & gcd not math
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(x, y):
    return (x * y) // gcd(x, y)

A, B = map(int, input().split())

print(lcm(A, B))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N = int(input())
A_list = list(map(int, input().split()))

div_sum_A = sum(A_list) / 2
ans = 0
calculator = 0
for i in range(N):
    calculator += A_list[i]
    if calculator >= div_sum_A:
        if calculator == div_sum_A:
            ans = 0
            break
        elif A_list[i] > div_sum_A:
            ans = 2 * A_list - calculator
            break
        else:
            cand_1 = calculator - (2 * div_sum_A - calculator)
            cand_2 = abs((calculator - A_list[i]) - (2 * div_sum_A - (calculator - A_list[i])))
            ans = min(cand_1, cand_2)
            break

print(int(ans))

Fixed submission:
# -*- coding: utf-8 -*-
N = int(input())
A_list = list(map(int, input().split()))
 
div_sum_A = sum(A_list) / 2
ans = 0
calculator = 0
for i in range(N):
    calculator += A_list[i]
    if calculator >= div_sum_A:
        if calculator == div_sum_A:
            ans = 0
            break
        elif A_list[i] > div_sum_A:
            ans = 2 * A_list[i] - calculator
            break
        else:
            cand_1 = calculator - (2 * div_sum_A - calculator)
            cand_2 = abs((calculator - A_list[i]) - (2 * div_sum_A - (calculator - A_list[i])))
            ans = min(cand_1, cand_2)
            break

print(int(ans))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# from collections import deque
import bisect

N, M = map(int, input().split())
A_list = list(map(int, input().split()))
A_list.sort()
# A_list = deque(A_list)

ans = 0
ans += sum(A_list[0:N - M])
del(A_list[0:N - M])
for i in range(M):
    max_price = A_list.pop()
    bisect.insort(A_list, max_price // 2)
    ans += A_list[0]
    del(A_list[0])
    

ans += sum(A_list)
print(ans)

Fixed submission:
# D 終了後再チャレンジ
# -*- coding: utf-8 -*-
import heapq

N, M = map(int, input().split())
A_list = list(map(int, input().split()))
A_list = [-a for a in A_list]
heapq.heapify(A_list)

for i in range(M):
    max_price = heapq.heappop(A_list) * (-1)
    heapq.heappush(A_list, max_price // 2 * (-1))
    
ans = sum(A_list) * (-1)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
# from collections import deque
import bisect

N, M = map(int, input().split())
A_list = list(map(int, input().split()))
A_list.sort()
# A_list = deque(A_list)

ans = 0
ans += sum(A_list[0:N - M])
del(A_list[0:N - M])
for i in range(M):
    max_price = A_list.pop()
    bisect.insort(A_list, max_price // 2)
    

ans += sum(A_list)
print(ans)

Fixed submission:
# D 終了後再チャレンジ
# -*- coding: utf-8 -*-
import heapq

N, M = map(int, input().split())
A_list = list(map(int, input().split()))
A_list = [-a for a in A_list]
heapq.heapify(A_list)

for i in range(M):
    max_price = heapq.heappop(A_list) * (-1)
    heapq.heappush(A_list, max_price // 2 * (-1))
    
ans = sum(A_list) * (-1)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import bisect

N, M = map(int, input().split())
A_list = list(map(int, input().split()))
A_list.sort()

for i in range(M):
    max_price = A_list.pop()
    bisect.insort(A_list, max_price // 2)

print(sum(A_list))

Fixed submission:
# D 終了後再チャレンジ
# -*- coding: utf-8 -*-
import heapq

N, M = map(int, input().split())
A_list = list(map(int, input().split()))
A_list = [-a for a in A_list]
heapq.heapify(A_list)

for i in range(M):
    max_price = heapq.heappop(A_list) * (-1)
    heapq.heappush(A_list, max_price // 2 * (-1))
    
ans = sum(A_list) * (-1)
print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
S = str(input())
T = str(input())

counter = 0
for i in range(S):
    if S[i] == T[i]:
        counter += 1

print(counter)

Fixed submission:
# -*- coding: utf-8 -*-
S = str(input())
T = str(input())

counter = 0
for i in range(len(S)):
    if S[i] == T[i]:
        counter += 1

print(counter)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
N = int(input())
a_list = list(map(int, input().split()))

M = 0
box_dict = {}
for i in reversed(range(N)):
    idx = i + 1
    multi_sum = 0
    for key, value in box_dict.items():
        if key % (idx * 2) == 0:
            multi_sum += value
    if a_list[i] - multi_sum == 0:
        box_dict[idx] = 0
    else:
        box_dict[idx] = 1
        M += 1

print(M)
if M > 0:
    b_list = [key for key, value in box_dict.items() if value == 1]
    print(" ".join(map(str, b_list)))

Fixed submission:
# -*- coding: utf-8 -*-
N = int(input())
a_list = list(map(int, input().split()))

M = 0
box_dict = {}
for i in reversed(range(N)):
    idx = i + 1
    multi_sum = 0
    if N // idx < 2:
        if a_list[i] == 0:
            box_dict[idx] = 0
        else:
            box_dict[idx] = 1
            M += 1
    else:
        for j in range(2, (N // idx) + 1):
            multi_sum += box_dict[idx * j]
        if a_list[i] - (multi_sum % 2) == 0:
            box_dict[idx] = 0
        else:
            box_dict[idx] = 1
            M += 1

print(M)
if M > 0:
    b_list = [key for key, value in box_dict.items() if value == 1]
    print(" ".join(map(str, b_list)))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N = int(input())
W_list = list(map(int, input().split()))

lr_sum = 0
pop_position = 1
for _ in range(N)
    if lr_sum <= 0:
        lr_sum += W_list[pop_position]
    else:
        lr_sum -= W_list[-pop_position]
print(lr_sum)

Fixed submission:
# -*- coding: utf-8 -*-
N = int(input())
W_list = list(map(int, input().split()))

lr_sum = 0
for _ in range(N):
    if lr_sum <= 0:
        lr_sum += W_list.pop(0)
    else:
        lr_sum -= W_list.pop(-1)
print(abs(lr_sum))
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
s = input()
count = s.count("ABC")
tmp_count = -1
if count != 0: 
    while tmp_count != 0:
        s = s.replace("ABC", "BCA")
        tmp_count = s.count("ABC")
        count += tmp_count
print(count)

Fixed submission:
# -*- coding: utf-8 -*-
s = input()
s = s.replace("BC", "X")
count = 0
a_stack = 0
for idx, char in enumerate(s):
    if char == "A":
        a_stack += 1
    elif char == "X":
        count += a_stack
    else:
        a_stack = 0
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import sys
s = input()
count = 0
count += s.count('ABC')
while count != 0:
    s = s.replace("ABC", "BCA")
    count += s.count('ABC')
print(count)

Fixed submission:
# -*- coding: utf-8 -*-
s = input()
s = s.replace("BC", "X")
count = 0
a_stack = 0
for idx, char in enumerate(s):
    if char == "A":
        a_stack += 1
    elif char == "X":
        count += a_stack
    else:
        a_stack = 0
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import sys
s = input()
count = 0
while s.count('ABC') != 0:
    count += s.count('ABC')
    s = s.replace("ABC", "BCA")
print(count)

Fixed submission:
# -*- coding: utf-8 -*-
s = input()
s = s.replace("BC", "X")
count = 0
a_stack = 0
for idx, char in enumerate(s):
    if char == "A":
        a_stack += 1
    elif char == "X":
        count += a_stack
    else:
        a_stack = 0
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import sys
s = input()
count = 0
while s.find("ABC") != -1:
    s = s.replace("ABC", "BCA", 1)
    count += 1
print(count)

Fixed submission:
# -*- coding: utf-8 -*-
s = input()
s = s.replace("BC", "X")
count = 0
a_stack = 0
for idx, char in enumerate(s):
    if char == "A":
        a_stack += 1
    elif char == "X":
        count += a_stack
    else:
        a_stack = 0
print(count)
Buggy python submission (verdict: Runtime Error):
a=int(input())
A=[]
B=[]
C=[0,1,2,6,24,120,720,5040,40320]
d=0
e=0
for p in range(a):
  s=int(input())
  A.append(s)
for q in range(a):
  b=int(input())
  B.append(b)
for i in range(a,1,-1):
  d1=C[i-1]*(A[a-i]-1)
  e1=C[i-1]*(B[a-i]-1)
  d=d+d1
  e=e+e1
print(abs(d-e))

Fixed submission:
import itertools
a=int(input())
z=tuple(map(int,input().split()))
x=tuple(map(int,input().split()))
y=list(itertools.permutations(z))
y.sort()
ans1=y.index(z)+1
ans2=y.index(x)+1
print(abs(ans1-ans2))
Buggy python submission (verdict: Runtime Error):
a=int(input())
s=input()
d=input()
z=""
for i in range(a):
  z+=s[i]
  z+=d[i]
print(z)


Fixed submission:
a=int(input())
s,d=input().split()
z=""
for i in range(a):
  z+=s[i]
  z+=d[i]
print(z)
Buggy python submission (verdict: Runtime Error):
a=input()
if a=="MON":
  print("6")
elif a=="SUN":
  ptint("7")
elif a=="TUE":
  print("5")
elif a=="WED":
  print("4")
elif a=="THU":
  print("3")
elif a=="FRI":
  print("2")
else:
  print("1")


Fixed submission:
a=input()
if a=="MON":
  print("6")
elif a=="SUN":
  print("7")
elif a=="TUE":
  print("5")
elif a=="WED":
  print("4")
elif a=="THU":
  print("3")
elif a=="FRI":
  print("2")
elif a=="SAT":
  print("1")
Buggy python submission (verdict: Runtime Error):
a=int(input())
s=input()
d=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
S=list(s)
for i in range(len(S)):
  z=S.index(S[i])
  S[i]=d[z+a]
print("".join(S))


Fixed submission:
a=int(input())
s=input()
d=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E"]
S=list(s)
for i in range(len(S)):
  z=d.index(S[i])
  S[i]=d[z+a]
print("".join(S))
Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
s=[]
for i in range(1,int(0.5*a+1)):
  if a%i==0:
    s.append(i+a//i)
print(min(s)-2)

Fixed submission:
n = int(input())
s=[]
a=0
for i in range(1, int(n ** 0.5) + 1):
    if n % i == 0:
      a=n//i
      s.append(n//i+n//a)
print(min(s)-2)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=[]
d=[]

for i in range(1,n+1):
  if n%i==0:
    s.append((i-1,n//i-1))

for i in s:
  d.append(i[0]+i[1])

print(min(d))



    




Fixed submission:
n = int(input())
s=[]
a=0
for i in range(1, int(n ** 0.5) + 1):
    if n % i == 0:
      a=n//i
      s.append(n//i+n//a)
print(min(s)-2)

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=[]
d=[(0,0)]

for i in range(1,n+1):
  if n%i==0:
    s.append((i-1,n//i-1))

for i in s:
  d.append(i[0]+i[1])

print(min(d))



    




Fixed submission:
n = int(input())
s=[]
a=0
for i in range(1, int(n ** 0.5) + 1):
    if n % i == 0:
      a=n//i
      s.append(n//i+n//a)
print(min(s)-2)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(x) for x in input().split()]
for i in range(1,n+1):
  print(a.index(i)+1)
  

  


Fixed submission:
n = int(input())
num_list = list(map(int,input().split()))
num_array = [0]*n
for i in range(n):
    num_array[num_list[i]-1] = i+1
for i in range(n):
    print(num_array[i])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(x) for x in input().split()]
for i in range(1,n+1):
  ans=a.index(i)+1
  print(ans)

  


Fixed submission:
n = int(input())
num_list = list(map(int,input().split()))
num_array = [0]*n
for i in range(n):
    num_array[num_list[i]-1] = i+1
for i in range(n):
    print(num_array[i])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
for i in range(1,n+1):
  ans=a.index(i)+1
  print(ans)

  


Fixed submission:
n = int(input())
num_list = list(map(int,input().split()))
num_array = [0]*n
for i in range(n):
    num_array[num_list[i]-1] = i+1
for i in range(n):
    print(num_array[i])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
for i in range(1,n+1):
  ans=a.index(i)+1
  print(ans)

  


Fixed submission:
n = int(input())
num_list = list(map(int,input().split()))
num_array = [0]*n
for i in range(n):
    num_array[num_list[i]-1] = i+1
for i in range(n):
    print(num_array[i])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
w=[]
for i in range(1,n+1):
  ans=a.index(i)+1
  w.append(ans)
for i in w:
  print(i)

  


Fixed submission:
n = int(input())
num_list = list(map(int,input().split()))
num_array = [0]*n
for i in range(n):
    num_array[num_list[i]-1] = i+1
for i in range(n):
    print(num_array[i])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
w=[]
for i in range(1,n+1):
  ans=a.index(i)+1
  w.append(ans)
for i in w:
  print(i)

  


Fixed submission:
n = int(input())
num_list = list(map(int,input().split()))
num_array = [0]*n
for i in range(n):
    num_array[num_list[i]-1] = i+1
for i in range(n):
    print(num_array[i])
Buggy python submission (verdict: Runtime Error):
s, t = input.split()
print(t, s, sep='')

Fixed submission:
s, t = input().split()
print(t, s, sep='')
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())
for i in range(k):
  if a > 0:
    a -= 1
  elif b > 0:
    b -= 1
print(a, b)

Fixed submission:
a, b, k = map(int, input().split())
sub = k - a  
a = max(0, a - k)
b = max(0, min(b - sub, b))
print(a, b)
Buggy python submission (verdict: Runtime Error):
N = int(input)
if N ==0:
  print(1)
else:
  print(0)

Fixed submission:
N = int(input())
if N ==0:
  print(1)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
n = list(input())
a = 0
for i in n:
  a +=int(i)
  
if a%9==0:
  print('Yes')
else:
  print('No')

Fixed submission:
m,n,k = map(int,input().split())
if m%n == 0:
  print(int(k*((m//n))))
elif m%n !=0:
  print(int(k*((m//n)+1)))
Buggy python submission (verdict: Runtime Error):
X,D,C = map(int,input().split())
count=abs(X)
a = X//C
b = X%C
if a>D:
  print(count-D*C)
elif a==D:
  print(b)
elif a<D:
  D = D-a
  if D%2==0:
    print(b)
  else:
    print(min(abs(b-C),abs(b+C)))

Fixed submission:
import itertools
N = int(input())
a = list(map(int,input().split()))
count=0
for a in list(itertools.combinations(a,3)):
  if a[0]!=a[1] and a[1]!=a[2] and a[0]!=a[2]:
    if a[1]+a[2]>a[0] and a[0]+a[2]>a[1] and a[0]+a[1]>a[2]:
      count+=1
  
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import math
N = int(input())
count=0
g = 0
y= 0
for i in range(1,N+1):
  y=int(N/i)
  g=y*(y+1)*i/2
  count+=g

print(int(count))

Fixed submission:
N = int(input())
count=0
g = 0
y= 0
for i in range(1,N+1):
  y=int(N/i)
  g=y*(y+1)*i/2
  count+=g

print(int(count))
Buggy python submission (verdict: Runtime Error):
from bisect import bisect_left
N = int(input())
a=list(map(int, input().split()))
Q = int(input())
b=[]
c=[]
for i in range(Q):
  b1,c1=map(int, input().split())
  b.append(b1)
  c.append(c1)
def index(lst, e):
    i = bisect_left(lst, e)
    if i == len(lst):
        raise ValueError
    if lst[i] != e:
        raise ValueError
    return i
for i in range(Q):
  first=0
  last = 0
  a.sort()
  if b[i] not in a:
    print(sum(a))
  else:
    last = a.count(b[i])
    first = index(a,b[i])
    del a[first:first+last]
    list_c = [c[i]]*last
    a = a+list_c
    print(sum(a))
  
  
  



Fixed submission:
N = int(input())
a = list('abcdefghijklmnopqrstuvwxyz')
name = 0
while N!=0:
  N-=1
  M = N%26
  N = N//26
  if name ==0:
    name = a[M]
  else:
    name = a[M]+name

print(name)
Buggy python submission (verdict: Runtime Error):
N  = int(input())
c = list(map(int,input().split()))

c.sort()
a = c[N-1]
list_c = [0]*(a+1)
for i in c:
  mal = 2
  b = i
  while i<=a:
    list_c[i]+=1
    i = b*mal
    mal+=1
count = 0
for i in c:
  if list_c[i]==1:
    count+=1
print(count)
    
    

Fixed submission:
N,M = map(int,input().split())
if M == 0:
  print(N)
else:
  c=list(map(int, input().split()))
  for i in range(N+1):
    for s in [-1,1]:
      a = N+s*i
      if c.count(a)==0:
      	print(a)
      	exit(0)