Problem:


Score : 400 points

Problem Statement

Given is a number sequence A of length N.

Find the number of integers i \left(1 \leq i \leq N\right) with the following property:

For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Constraints

All values in input are integers.

1 \leq N \leq 2 \times 10^5

1 \leq A_i \leq 10^6

Input

Input is given from Standard Input in the following format:

N
A_1 A_2 \cdots A_N

Output

Print the answer.

Sample Input 1

5
24 11 8 3 16

Sample Output 1

3

The integers with the property are 2, 3, and 4.

Sample Input 2

4
5 5 5 5

Sample Output 2

0

Note that there can be multiple equal numbers.

Sample Input 3

10
33 18 45 28 8 19 89 86 2 4

Sample Output 3

5



Sample input:
5
24 11 8 3 16


Sample output:
3

Submission status: Wrong Answer

Solution code:
def examA():
    X = LI()
    for i in range(len(X)):
        if X[i]==0:
            ans = i+1
    print(ans)
    return

def examB():
    X, Y = LI()
    ans = "No"
    for i in range(X+1):
        if i*2+(X-i)*4==Y:
            ans = "Yes"
    print(ans)
    return

def examC():
    X, N = LI()
    P = LI()
    P = set(P)
    cur = inf
    ans = -1
    for i in range(-1,102):
        if i in P:
            continue
        now = abs(i-X)
        if now<cur:
            ans = i
            cur = now
    print(ans)
    return

def examD():
    N = I()
    A = LI()
    n = max(A)
    C = set()
    D = set()
    for a in A:
        if a in D:
            C.discard(a)
            continue
        D.add(a)
        C.add(a)
    #if 1 in D:
    #    if 1 in C:
    #        print(1)
    #    else:
    #        print(0)
    #    return
    C2 = deepcopy(C)
    for a in C:
        for i in range(2,1+n//a):
            if (i*a) in C2:
                C2.discard(i*a)
    ans = len(C2)
    print(ans)
    return

def examE():
    N, Q = LI()
    AB = [LI()for _ in range(N)]



    ans = 0
    print(ans)
    return

def examF():
    H, W, K = LI()
    x1,y1,x2,y2 = LI()
    x1 -= 1; y1 -= 1; x2 -= 1; y2 -= 1
    C = [SI()for _ in range(H)]

    def bfs_grid(h, w, s, maze):
        distance = [[inf] * w for _ in range(h)]

        def bfsg():
            queue_up = deque()
            queue_d = deque()
            queue_r = deque()
            queue_l = deque()
            queue_up.append(s)
            queue_d.append(s)
            queue_r.append(s)
            queue_l.append(s)
            distance[s[0]][s[1]] = 0
            while (len(queue_up) or len(queue_r) or len(queue_d) or len(queue_l)):
                if queue_up:
                    y, x = queue_up.popleft()
                    for k in range(1, K + 1):
                        nx, ny = x, y + k
                        if (0 <= nx < w and 0 <= ny < h and maze[ny][nx] != '@'):
                            if distance[ny][nx] <= distance[y][x] + 1:
                                continue
                            queue_r.append((ny, nx))
                            queue_l.append((ny, nx))
                            distance[ny][nx] = distance[y][x] + 1
                        else:
                            break
                        if k == K:
                            queue_up.append((ny, nx))
                if queue_d:
                    y, x = queue_d.popleft()
                    for k in range(1, K + 1):
                        nx, ny = x, y - k
                        if (0 <= nx < w and 0 <= ny < h and maze[ny][nx] != '@'):
                            if distance[ny][nx] <= distance[y][x] + 1:
                                continue
                            queue_r.append((ny, nx))
                            queue_l.append((ny, nx))
                            distance[ny][nx] = distance[y][x] + 1
                        else:
                            break
                        if k == K:
                            queue_d.append((ny, nx))
                if queue_r:
                    y, x = queue_r.popleft()
                    for k in range(1, K + 1):
                        nx, ny = x + k, y
                        if (0 <= nx < w and 0 <= ny < h and maze[ny][nx] != '@'):
                            if distance[ny][nx] <= distance[y][x] + 1:
                                continue
                            queue_up.append((ny, nx))
                            queue_d.append((ny, nx))
                            distance[ny][nx] = distance[y][x] + 1
                        else:
                            break
                        if k == K:
                            queue_r.append((ny, nx))
                if queue_l:
                    y, x = queue_l.popleft()
                    for k in range(1, K + 1):
                        nx, ny = x - k, y
                        if (0 <= nx < w and 0 <= ny < h and maze[ny][nx] != '@'):
                            if distance[ny][nx] <= distance[y][x] + 1:
                                continue
                            queue_up.append((ny, nx))
                            queue_d.append((ny, nx))
                            distance[ny][nx] = distance[y][x] + 1
                        else:
                            break
                        if k == K:
                            queue_l.append((ny, nx))

            return distance

        return bfsg()
    L = bfs_grid(H,W,(x1,y1),C)
    #print(L)
    ans = L[x2][y2]
    if ans==inf:
        ans = -1
    print(ans)
    return

from decimal import Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examD()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
ans=0
chklist=[1]*n
for i in range(n):
  if chklist[i]==1:
    for j in range(i+1,n):
      if chklist[j]==1:
        if a[i] < a[j]:
          if a[j]%a[i]==0:
            chklist[j]=0
        else:
          if a[i]%a[j]==0:
            chklist[i]=0
chkflag=True
for i in range(n-1):
  if a[i]!=a[i+1]:
    chkflag=False
    break
if chkflag:
  print(0)
else:
  print(sum(chklist))

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
a = sorted(list(map(int,input().split())))
if 1 < len(a):
    c = 1 if a[0] == a[1] else 0
else:
    c = 0
for i in range(1, n):
    x = a[i]
    for j in range(math.ceil(i/2)):
        if (x % a[j] == 0) or (x % a[i-j] == 0):
            break
    else:
        continue
    c+=1
print(n-c)

Submission status: Wrong Answer

Solution code:
from collections import deque
n = int(input())
an = list(map(int, input().split()))

an.sort()
an = deque(an)
ls = deque()
same = [-1]
while an:
    a = an.popleft()
    t = True
    if same[-1] == a:
      continue
    for i in ls:
        if a == i:
            ls.pop()
            same.append(a)
            t = False
            break
        if a % i == 0:
            t = False
            break
    if t:
        ls.append(a)

print(len(ls))

Submission status: Wrong Answer

Solution code:
n = int(input())
A = list(set(map(int, input().split())))
sortedA = sorted(A)

count = 0
for Ai in A:
  flag = 0
  for Aj in sortedA:
    if Ai == Aj:
      continue
    if (Ai % Aj) == 0:
      flag = 1
      break
  if flag == 0:
    count += 1
if len(A) == 1:
  print(0)
else:
  print(count)

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    if n == 1:
        print(0)
        return
    l = list(map(int,input().split()))
    l.sort(reverse=True)

    num=0
    for i in range(len(l)-1):
        for d in l[i+1:]:
            if (l[i]/d).is_integer():
                num += 1
                break
    if l[-2]==l[-1]:
        num += 1
    print(len(l)-num)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())
A = list(map(int, input().split()))

A.sort()
if A[0] == A[-1]:
    print(0)
    sys.exit(0)
if A[0] == 1:
    print(1)
    sys.exit(0)

d =[]

for i in range(len(A)):
    flag = True
    for j in d:
        if A[i] % j == 0:
            flag = False
            break
    if flag:
        d.append(A[i])

print(len(d))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
"""AtCoder Beginner Contest 170: D - Not Divisible
https://atcoder.jp/contests/abc170/tasks/abc170_d
"""


prime_cache = {}


def is_prime(n):
    if n < 2:
        return False
    if n == 2:
        return True
    for p in range(2, n):
        if n % p == 0:
            return False
    return True


def main():
    global prime_cache
    N = int(input())
    As = list(map(int, input().split()))

    ans = set()
    for i in range(N):
        is_divisible = False
        if As[i] in prime_cache:
            continue
        if As.count(As[i]) == 1 and is_prime(As[i]):
            prime_cache[As[i]] = True
            ans.add(i + 1)

        for j in range(N):
            if i != j and As[i] % As[j] == 0:
                is_divisible = True
                break
        # print('i({}):{}, j({}):{}'.format(i, As[i], j, As[j]))
        if not is_divisible:
            ans.add(i + 1)

    print(len(ans))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python3

n = int(input())
A = [int(s) for s in input().split(" ")]

from itertools import product
lst = []
for x, y in product(A, A):
    lst.append(x%y)

counter = 0
for i in range(n):
    if lst[i*10:i*10+n].count(0) == 1:
        counter=counter+1
print(counter)

Submission status: Wrong Answer

Solution code:
import math
import sys
 
def isPrime(n):
  if n == 2:
    return True
  if n % 2 == 0:
    return False
  
  # nの平方根まで計算する
  m = math.floor(math.sqrt(n)) + 1
  for p in range(3, m, 2):
      if n % p == 0:
        return False
  return True


n=int(input())
As = list(map(int, input().split()))
i=0
j=0
count =0
if As.count(1)==1:
    print(1)
    sys.exit()
if As.count(1)>=2:
    print(0)
    sys.exit()
for a in As:
    if As.count(a)>=2:
        i+=1
        continue
    elif isPrime(a):
        count+=1
        i+=1
        continue
    for b in As:
        if a<b:
            continue
        if i!=j:
            if a%b==0:
                break
            elif j==n-1:
                count+=1
        elif j==n-1:
            count+=1
        j+=1
    i+=1
    j=0

print(count)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input().rstrip().split(' ')

a=[]
for i in s:
        a.append(int(i))
a.sort(reverse=True)
count=0
for i in range(n):
    flag=False
    for j in range(n):
        if(i==j):
            continue
        if(a[i]<a[n-j-1]*2):
            break
        if(a[i]%a[n-j-1]==0):
            flag=True
    if(not flag):
        count+=1
print(count)

Submission status: Wrong Answer

Solution code:
# def factorization(n):
#     arr = []
#     temp = n
#     for i in range(2, int(-(-n**0.5//1))+1):
#         if temp%i==0:
#             cnt=0
#             while temp%i==0:
#                 cnt+=1
#                 temp //= i
#             arr.append([i, cnt])

#     if temp!=1:
#         arr.append([temp, 1])

#     if arr==[]:
#         arr.append([n, 1])

#     return arr
import collections
def smallest_prime_factors(n):

    spf = [[] for _ in range(n+1)]
    for i in range(n+1):
        spf[i] = i
    i = 2
    while i*i <= n:
        if spf[i] == i:
            for j in range(i*i, n+1, i):
                if spf[j] == j:
                    spf[j] = i
        i += 1

    return spf

def factolization(x,spf):
    ret = []
    while (x != 1):
        ix = int(x)
        ret.append(spf[ix])
        x /= spf[ix]
    return sorted(ret)

spf = smallest_prime_factors(1000000)

import sys
# x,y = map(int,input().split())
n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
cnt = 0
kiti = []

for ix,i in enumerate(a):
    flag = False
    tyouhuku = False
    if ix < len(a)-1:
        if i == a[ix+1]:
            tyouhuku = True
            kiti.append(i)
    facts = factolization(i,spf)
    c = collections.Counter(facts)
    yousos = list(c.items())
    for youso in yousos:
        for beki in range(youso[1]+1):
            val = pow(youso[0],beki)
            if val in kiti:
                flag = True
                break
        else:
            continue
        break
    if flag == False:
        cnt += 1
    if tyouhuku == False:
        kiti.append(i)

print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
num_ans = 0

if len(a) == 1:
    num_ans = 1
else:
    a = list(set(a))
    a.sort()
    if len(a) == 1:
        num_ans = 0
    else:
        for i in range(len(a)):
            flag = True
            for j in range(i):
                if a[i] % a[j] == 0:
                    flag = False
                    break
            if flag:
                num_ans += 1

print(num_ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin,stdout
#x,n=map(int,stdin.readline().split())
n=int(stdin.readline())
a=list(map(int,stdin.readline().split()))
s=set(a)
if len(s)==1:
    print(0)
    exit(0)
m2=max(s)
p=0
while p<n and a[p] in s:
    mul=a[p]
    v=2*a[p]
    while v<=m2:
        if v in s:
            s.remove(v)
        v+=mul
    p+=1
print(len(s))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = input().split()
A = [int(s) for s in A]
list.sort(A)

count = 0
if N == 1:
    count = 1

else:
    for i in range(1,N):
        for j in range(i):
            if A[i]%A[j] == 0:
                count += 1
                break

            
    if A[0] == A[1]:
        count += 1

print(N-count)

Submission status: Wrong Answer

Solution code:
N = int,input()
p = sorted(list(map(int,input().split())))
#print(p)
count = 0

for i in p:
    sabun = list(set(p) - set([i]))
    if len(sabun) == 0:
        count = len(p)
    for j in sabun:
        if i % j == 0:
            count += 1
            break
    
print(len(p)-count)

Submission status: Wrong Answer

Solution code:
from collections import Counter


def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i * i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n // i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


n = int(input())
a = list(map(int, input().split()))

c = Counter(a)
new = [key for key, val in c.most_common() if val == 1]
div = [make_divisors(i) for i in new]

ans = 0
for i in range(len(new)):
    val = set(div[i]) & set(new)
    if len(val) == 1:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
n  = int(input())
#  = map(int, input().split())
l  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
c = collections.Counter(l)
l = sorted(c.keys())

def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

if len(l) == 1 or l[0] == 1:
    print(0)
    exit()

is_sosu = [False for _ in range(l[-1] + 1)]
ans = 0
for i1 in range(len(l)):
    d = divisor(l[i1])
    b = [is_sosu[d_] for d_ in d]
    
    if not True in b:
        ans += 1

    is_sosu[l[i1]] = True

print(ans)

Submission status: Wrong Answer

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
A = LI()
A.sort()

cc = collections.Counter(A)
a = []
for key in cc.keys():
    if cc[key] > 1:
        continue
    else:
        a.append(key)
a.sort()
chosen = []
if len(a) > 0:
    chosen = [a[0]]
else:
    print("0")
    sys.exit()

# a = collections.deque(a)

cnt = 0
while len(a) > 0:
    chosen = a[0]
    cnt += 1
    for a_i in a:
        if a_i % chosen == 0:
            a.remove(a_i)
    
print(cnt)

Submission status: Wrong Answer

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

ans_list=[i for i in range(N)]
for i in range(N):
  for j in range(i+1,N):
    if i in ans_list:
      if A[i]/A[j]-int(A[i]/A[j])==0:
        ans_list.remove(i)
    if j in ans_list:
      if A[j]/A[i]-int(A[j]/A[i])==0:
        ans_list.remove(j)  
        break
      
print(len(ans_list))
#print(gcd_list)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
def find_i(i, bools, N):
    for j in range(i+1, N):
        if bools[j] == True:
            return j
    return N
from collections import Counter
def Main(N, A):
    c = Counter(A)
    if len(c) == 1:
        return 0
    A.sort()
    bools = [True]*N
    i = 0
    while i < N:
        for j in range(i+1, N):
            if A[j]%A[i] == 0:
                bools[j] = False
        i = find_i(i, bools, N)
    return bools.count(True)

print(Main(N, A))

Submission status: Wrong Answer

Solution code:
import copy
N = int(input())
A = list(map(int, input().split()))
if A.count(A[0]) == len(A):
  print('0')
else:
  A_ = copy.copy(A)
  A.sort()
  c = A_.index(A[0])
  print(c+1)

Submission status: Wrong Answer

Solution code:
from collections import Counter
def divisor(n):
    fac = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0: 
            fac.append(i)
            if i*i != n: fac.append(n//i)
    return sorted(fac)
n = int(input())
a = [int(i) for i in input().split()]
c = Counter(a)
na = []
for k,v in c.items():
    if v == 1: na.append(k)
na.sort()
flag = [False]*(10**6+1)
ans = 0
for i in range(len(na)):
    for f in divisor(na[i]):
        if flag[f]: break
    else:
        ans += 1
    flag[na[i]] = True
print(ans)

Submission status: Wrong Answer

Solution code:
import math
def is_prime(n):
    if n == 1: return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True

n = int(input())
a = list(map(int, input().split()))
# a = list(set(a))
# n = len(a)
ans = 0
prime_1 = False
if 1 in a:
    prime_1 = True

for i in range(n):
    if is_prime(a[i]):
        if prime_1 == False and a[i] not in a:
            print("prime",a[i])
            ans += 1
            continue
    flag = True
    for j in range(n):
        if i != j and a[i] % a[j] == 0:
            flag = False
            break
    if n != 1 and flag:
        ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
def func(alist,num):
    rl=[]
    rl.append(num)
    for di in alist:
        if di%num!=0:rl.append(di)
    return sorted(rl)

n=int(input())
a=sorted(map(int,input().split()))
if len(set(a))==1:print(0);exit()
i=0
while(True):
    a=(func(a,a[i]))
    i+=1
    if len(a)<=i:break
print(len(a))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
from collections import defaultdict

def get_prime_factors(n):
    dd = defaultdict(lambda: 0)
    if n > 1:
        i = 2
        while i * i <= n:
            if n % i == 0:
                dd[i] += 1
                n /= i
                i = 2
            else:
                i += 1
        dd[n] += 1
    return dd


def solve(N: int, A: "List[int]"):
    A = sorted(list(set(A)))
    if len(A) == 1:
        print(0)
        return
    
    count = 0

    dd = defaultdict(lambda: (0, 10**6+1))
    
    for a in A:
        d = get_prime_factors(a)

        flag = True
        for prime, value in d.items():
            dd_val, dd_mn = dd[prime]
            
            if a % dd_mn==0:
                flag = False
                break

            dd[prime] = (dd_val + value, min(dd_mn, a))
            
        if flag:
            count+= 1

    print(count)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
dic = defaultdict(int)
for a in A:
  dic[a] += 1

A = list(set(A))
A.sort()
B = []
for a in A:
  flag = True
  for b in B:
    if a % b == 0:
      flag = False
      break

  if flag:
    if dic[a] == 1:
      B += [a]

print(len(B))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
a.sort()
b=[]
kas=set()
for i in a:
    if len(b)==0:
        b.append(i)
    elif i in b:
        kas.add(i)
    else:
        flag= True
        for j in b:
            if j>500:
                break
            if i % j ==0:
                flag=False
                break         
        if flag:
            b.append(i)
print(len(b)-len(kas))

Submission status: Wrong Answer

Solution code:
import numpy as np
import math
import collections
import bisect


def divisor(n):
    i = 1
    table = []
    while(i * i <= n):
        if n % i == 0:
            table.append(i)
            table.append(n // i)
        i += 1
    table = list(set(table))
    return table


N = int(input())

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

A.sort()

ans = 0
ans = N
for i in range(N):
    divs = divisor(A[i])
    divs.sort()
    print(A[i], "divs", divs)
    if i < N - 1:
        if A[i] == A[i + 1]:
            ans -= 1
            continue

    for d in divs:
        if i != 0:
            #print(set(A[:i]), d)
            if d in set(A[:i]):
                ans -= 1
                break
print(ans)

Submission status: Wrong Answer

Solution code:
import collections
n=int(input())
a = list(map(int, input().split()))
f=list(set(a))
g=0
for i,b in enumerate(f):
    for j,c in enumerate(f,start=i):
        if i!=j and b%c==0:
            f.pop(i)
            break

co=collections.Counter(a)
for k in co.values():
    if k>1:
        g+=1

print(len(f)-g)

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline

n=int(input())
a=list(map(int,input().split()))
flag=1
cnt=0
for i in range(n):
    for j in range(n):
        if i==j:
            pass
        else:
            flag*=a[i]%a[j]
            break
    if flag==0:
        flag=1
    else:
        cnt+=1
print(cnt)

Submission status: Wrong Answer

Solution code:
# import numpy as np
# import heapq

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

N = int(input())

As = list(map(int, input().split()))

As.sort()

if N == 1:
    print(1)
    exit()

sosus = [As[0]]
ans = 1 if As[0] != As[1] else 0

As.append(-1)

for i in range(1, N):
    a = As[i]
    prime_factors = prime_factorize(a)
    if len(prime_factors) == 1:
        if a not in sosus:
            sosus.append(a)
        if a != As[i+1] and a != As[i-1]:
            ans += 1
        continue

    flag = True
    for sosu in sosus:
        if a % sosu == 0:
            flag = False
            break
        elif sosu > a//2:
            break
    if flag and a not in sosus:
        sosus.append(a)
        ans += 1


print(ans)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
A = list(map(int, input().split()))
A.sort()

count = 0
if N == 1:
  print(1)
else:
  if A[0] != A[1]:
    count+=1
  for i in range(1,N):
    flag = 1
    for j in range(0, i, 1):
      #print(A[i], A[j])
      if A[i] % A[j] == 0:
        flag = 0
        break
    if flag == 1:
      count+=1
print(count)

Submission status: Wrong Answer

Solution code:
import bisect

n = int(input())
a = list(map(int, input().split()))
a.sort()
k = len(a)
ok = [0] * k
for i in range(k):
    if ok[i] == 1:
        continue
    if i < k - 1 and a[i] == a[i + 1]:
        ok[i] = 1
    if a[i] < 2 * 10 ** 4:
        for j in range(i + 1, k):
            if a[j] % a[i] == 0:
                ok[j] = 1
    else:
        times = 1
        while a[i] * times < a[-1]:
            r = bisect.bisect_left(a, a[i] * times)
            l = bisect.bisect_left(a, a[i] * times)
            if r != l:
                for idx in range(l, r):
                    ok[idx] = 1
            times += 1
print(len([i for i in ok if i == 0]))
#print(ok)

Submission status: Wrong Answer

Solution code:
from collections import deque
n=int(input())
aaa=list(map(int,input().split()))
aaa.sort()
aa=deque(aaa)
count=0
while aa:
    a=aa.popleft()
    if len(aa)!=0:
        b=aa.popleft()
    else:
      b=float("inf")
    if a!=b:
        count+=1
    if b!=float("inf"):
      aa.appendleft(b)
    k=len(aa)
    aa=set(aa)
    for t in set(aa):
        if t%a==0:
          aa.discard(t)
    aa=deque(list(aa))
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
a = list(set(a))
a.sort(reverse=True)
if len(a) == 1:
    ans = 0
else:
    ans = 1

for i in range(len(a)):
    for j in range(1 + i, len(a)):
        if j == n-1:
            if a[i] // a[j] != a[i] / a[j]:
                ans += 1
        if a[i] // a[j] != a[i] / a[j]:
            continue
        else:
            break
        break

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
B = sorted(list(set(A)))

NotD = 0
if len(B)>=2:
    for T in range(1,len(B)):
        Target = B[T]
        Count = 0
        Flag  = True
        for TT in range(0,T):
            BY = B[TT]
            if Target%BY==0:
                Flag = False
                break
            else:
                Count += 1
        if Flag and Count==T and A.count(B[T])==1:
            NotD += 1
    print(NotD+1)
else:
    print(NotD)