Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

#2
s = list(input())
flag = 1
cnt = 0
while flag :
    cant = 0
    for i in range(len(s)-1):
        if s[i] == 'B' and s[i+1] == 'W':
            s[i],s[i+1] = s[i+1],s[i]
            cnt += 1
        else:
            cant += 1
    if cant == len(s)-1:
        flag = 0
print(cnt)
        

### FIXED CODE ###

s = input()
t = 0
ans = 0

for i in range(len(s)):
    if s[i] == 'W':
        ans += (i-t)
        t += 1
print(ans)
### BUGGY CODE ###

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


count = 0
li = sorted(li)

l = [x for x in set(li) if li.count(x) > 1]
if len(l) == 0:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

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

is_break = False
seen = set()
for a in A:
    if a not in seen:
        seen.add(a)
    else:
        is_break=True
        break

if is_break:
    print('NO')
else:
    print('YES')
### BUGGY CODE ###

N, X, Y = map(int, input().split())
X = X-1
Y = Y-1

cnt = [0]*N
for i in range(N):
    for j in range(N):
        if j >= i:
            continue
        dist = min(abs(i-j),
                   abs(X-i) + abs(Y-j) + 1,
                   abs(X-j) + abs(Y-i) + 1)
        cnt[dist] += 1

print(*cnt[1:], sep='\n')


### FIXED CODE ###

N, X, Y = map(int, input().split())
X = X-1
Y = Y-1

cnt = [0]*N
for i in range(N):
    for j in range(i+1, N):
        dist = min(abs(i-j),
                   abs(X-i) + abs(Y-j) + 1,
                   abs(X-j) + abs(Y-i) + 1)
        cnt[dist] += 1

print(*cnt[1:], sep='\n')
### BUGGY CODE ###

s = str(input())
q = int(input())
g = 0
for i in range(q):
  query = input()
  if (query == "1"):
    g = 1-g
  else:
    queries = query.split()
    f = int(queries[1])-1
    c = queries[2]
    if (g == f):
      s = c + s
    else:
      s = s + c
if (g == 1):
  s = "".join(list(s)[::-1])
print(s)

### FIXED CODE ###

s = str(input())
q = int(input())
g = 0
A = ""
B = ""
for i in range(q):
  query = input()
  if (query == "1"):
    g = 1-g
  else:
    queries = query.split()
    f = int(queries[1])-1
    c = queries[2]
    if (g == f):
      B = "".join([B,c])
    else:
      A = "".join([A,c])
s = "".join(["".join(list(B)[::-1]),s,A])
if (g == 1):
  s = "".join(list(s)[::-1])
print(s)
### BUGGY CODE ###

import math
N=int(input())
root=math.ceil(math.sqrt(N)+1)
ans=0
for i in range(root,N+1):
    if not N%i:
        ans+=i-1
print(ans)

### FIXED CODE ###

import math
N=int(input())
root=math.ceil(math.sqrt(N))
ans=0
for i in range(1,root):
    if not N%i:
        if N//i>i+1:
            ans+=N//i-1
print(ans)
### BUGGY CODE ###

n = int(input())
s = str(input())

cnt = 0
for i in range(n - 2):
    for j in range(i + 1,n -1):
        for k in range(j + 1,n):
            if s[i] != s[j] and s[i] != s[k] and s[j] != s[k] and j - i != k - j:
                cnt += 1
print(cnt)

### FIXED CODE ###

n = int(input())
s = str(input())

cnt = 0
"""
for i in range(n - 2):
    for j in range(i + 1,n -1):
        for k in range(j + 1,n):
            if s[i] != s[j] and s[i] != s[k] and s[j] != s[k] and j - i != k - j:
                cnt += 1
                """

for i in range(n -2):
    num = 1
    while i + (num)* 2 <= n -1:
        if s[i] != s[i + num] and s[i] != s[i + 2 * num] and s[i + num] != s[i + 2 * num]:
            cnt += 1
        num += 1
print(s.count("R") * s.count("G") * s.count("B") - cnt)
### BUGGY CODE ###

# ABC155 C

n = int(input())
S = []

for _ in range(n):
    S.append(input())

set_S = list(set(S))
count_S = []

for string in set_S:
    count_S.append(S.count(string))

index_nums = [n for n, v in enumerate(count_S) if v == max(count_S)]
res = []

for i in index_nums:
    res.append(set_S[i])

for _ in sorted(res):
    print(_)

### FIXED CODE ###

# ABC155 C

n = int(input())
S = {}
max_S = 0
res = []

for _ in range(n):
    s = input()
    if s in S:
        S[s] += 1
        if S[s] > max_S:
            max_S = S[s]
    else:
        S[s] = 1
        if S[s] > max_S:
            max_S = S[s]

for key in S:
    if S[key] == max_S:
        res.append(key)

for _ in sorted(res):
    print(_)
### BUGGY CODE ###

# D - Powerful Discount Tickets

N, M = map(int, input().split())
A = [int(a) for a in input().split()]

for i in range(M):
    mx = A.index(max(A))
    A[mx] = A[mx] // 2

print(sum(A))


### FIXED CODE ###

# D - Powerful Discount Tickets

import heapq

N, M = map(int, input().split())
A = [int(a) * -1 for a in input().split()]
heapq.heapify(A)

for i in range(M):
    price = heapq.heappop(A)
    price = -1 * ((-1 * price) // 2)
    heapq.heappush(A, price)

print(sum(A) * -1)
### BUGGY CODE ###

n,C=map(int,input().split())
d=[]
c=[]
for i in range(C):
    d.append([int(j) for j in input().split()])
for i in range(n):
    c.append([int(j) for j in input().split()])
l1=[0 for i in range(C+1)]
l2=[0 for i in range(C+1)]
l3=[0 for i in range(C+1)]

for i in range(n):
    for j in  range(n):
        if (i+j+2)%3==0:
            for k in range(1,C+1):
                l1[k]+=d[c[i][j]-1][k-1]
        if (i+j+2)%3==1:
            for k in range(1,C+1):
                l2[k]+=d[c[i][j]-1][k-1]
        if (i+j+2)%3==2:
            for k in range(1,C+1):
                l3[k]+=d[c[i][j]-1][k-1]
ans=10**100
for i in range(1,C+1):
    for j in range(1,C+1):
        for k in range(1,C+1):
            if i!=j and i!=k and j!=k:
                ans=min(ans,l1[i]+l2[j]+l3[k])
print(ans)

### FIXED CODE ###

n,C=map(int,input().split())
d=[]
c=[]
for i in range(C):
    d.append([int(j) for j in input().split()])
for i in range(n):
    c.append([int(j) for j in input().split()])
l1=[0 for i in range(C+1)]
l2=[0 for i in range(C+1)]
l3=[0 for i in range(C+1)]

for i in range(n):
    for j in  range(n):
        if (i+j+2)%3==0:
            for k in range(1,C+1):
                l1[k]+=d[c[i][j]-1][k-1]
        if (i+j+2)%3==1:
            for k in range(1,C+1):
                l2[k]+=d[c[i][j]-1][k-1]
        if (i+j+2)%3==2:
            for k in range(1,C+1):
                l3[k]+=d[c[i][j]-1][k-1]
ans=10**100
for i in range(1,C+1):
    for j in range(1,C+1):
        for k in range(1,C+1):
            if i!=j and i!=k and j!=k:
                ans=min(ans,l1[i]+l2[j]+l3[k])
print(ans)
### BUGGY CODE ###

N = int(input())
S = input()
sum = 0

for i in range(N):
    for j in range(i+1,N):
        a = S[i]
        b = S[j]
        if a == b:
            continue
        for k in range(j+1,N):
            c = S[k]
            if a!=c and b!=c and j-i!=k-j:
                sum += 1

print(sum)


### FIXED CODE ###

N = int(input())
S = input()
sum = 0
r = 0
g = 0
b = 0

for i in range(N):
    if S[i] == "R":
        r+=1
    elif S[i] == "G":
        g+=1
    else:
        b+=1

sum = r*g*b

for i in range(N):
    for j in range((N-i)//2 +1):
        try:
            a = S[i]
            b = S[i+j]
            c = S[i+2*j]
            if a!=b and b!=c and c!=a:
                sum -= 1
        except:
            continue

print(sum)
### BUGGY CODE ###

#三井住友2019 D
def main():
    import sys
    import itertools as ite
    N = int(sys.stdin.readline())
    S = sys.stdin.readline().rstrip()
    L = ite.product([0,1,2,3,4,5,6,7,8,9], repeat=3)
    cnt=0
    for pw in L:
        #print(pw)
        num=0
        for i in range(N):
            if int(S[i])==pw[num]:
                num +=1
            if num==3:
                cnt +=1
                #print(pw)
                break
    print(cnt)


if __name__=='__main__':
    main()

### FIXED CODE ###

#三井住友2019 D 貪欲法
def main():
    import sys
    N = int(sys.stdin.readline())
    S = sys.stdin.readline().rstrip()
    ans = 0
    for i in range(1000):
        num = str(i).zfill(3)
        L = []
        k = 0
        for j in range(N):
            #print(num, S[j])
            if int(S[j])==int(num[k]):
                #print('Yes', num)
                L.append(S[j])
                k+=1
            if len(L)==3:
                #print(L)
                ans +=1
                break
                
    print(ans)
        
    
if __name__=='__main__':
    main()
### BUGGY CODE ###

s = list(input())
t = list(input())
a = len(s)
b = len(t)
dp = [[""]*(b+1) for _ in range(a+1)]
#dp[i][j]はi文字目までのsとtのj文字目までの共通部分
for i in range(a):
  for j in range(b):
    if s[i] == t[j]:
      dp[i+1][j+1] = dp[i][j]+s[i]
    else:
      dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j],key = len)
print(dp[-1][-1])

### FIXED CODE ###

s = list(input())
t = list(input())
a = len(s)
b = len(t)
dp = [[0]*(b+1) for _ in range(a+1)]
ans = ""
#dp[i][j]はi文字目までのsとtのj文字目までの共通部分
for i in range(a):
  for j in range(b):
    if s[i] == t[j]:
      dp[i+1][j+1] = dp[i][j]+1
    else:
      dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j])
i = a
j = b
while(i>=0 and j>=0):
  if dp[i][j] == dp[i-1][j]:
    i -= 1
  elif dp[i][j] == dp[i][j-1]:
    j -= 1
  else:
    ans = t[j-1]+ans
    i -= 1
    j -= 1
print(ans)
### BUGGY CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
# def LIST(): return list(map(str, input().split()))
# def LIST(): return list(input())

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
h = LIST()

dp = [INF] * N
dp[0] = 0
for i in range(N):
    for j in range(1, K+1):
        if i + j < N:
            dp[i+j] = min(dp[i] + abs(h[i] - h[i+j]), dp[i+j])
        # if dp[i] >= dp[i-j] + abs(h[i]-h[i-j]):
        #     dp[i] = dp[i-j] + abs(h[i]-h[i-j])
print(dp[-1])



### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
# def LIST(): return list(map(str, input().split()))
# def LIST(): return list(input())

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
h = LIST()

dp = [INF] * N
dp[0] = 0
for i in range(N):
    for j in range(1, K+1):
        if i + j < N:
            dp[i+j] = min(dp[i] + abs(h[i] - h[i+j]), dp[i+j])
        # if dp[i] >= dp[i-j] + abs(h[i]-h[i-j]):
        #     dp[i] = dp[i-j] + abs(h[i]-h[i-j])
print(dp[-1])
### BUGGY CODE ###

from itertools import combinations

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

V = []
for x in X:
    V.append(x - A)

ans = 0
for r in range(1, len(V)+1):
    C = list(combinations(V, r))
    for c in C:
        if sum(c) == 0:
            ans += 1
print(ans)


### FIXED CODE ###

# 配るDP
N, A = map(int, input().split())
X = list(map(int, input().split()))

dp = [[[0 for _ in range(3010)] for __ in range(N+1)] for ___ in range(N+1)]

dp[0][0][0] = 1

for i in range(N):
    for j in range(N):
        for k in range(2500+1):
            if dp[i][j][k]:
                dp[i+1][j][k] += dp[i][j][k]
                dp[i+1][j+1][k+X[i]] += dp[i][j][k]

ans = 0
for n in range(1, N+1):
    ans += dp[N][n][n*A]

print(ans)
### BUGGY CODE ###

K = int(input())

a = 7
p = -1
ans = 0

while True:
    t = a % K
    ans += 1
    if t == 0:
        print(ans)
        break
    if t == p:
        print(-1)
        break
    a = 10*t + 7
    p = t


### FIXED CODE ###

K = int(input())

a = 7
p = {}
ans = 0

while True:
    t = a % K
    ans += 1
    if t == 0:
        print(ans)
        break
    if t in p:
        print(-1)
        break
    a = 10*t + 7
    p[t] = 1
### BUGGY CODE ###

a, loop = input().split()
string = input()

for i in range(int(loop)):
  j, k = input().split()
  print(string[int(j)-1:int(k)].count('AC'))

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
  t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
  l, r = map(int, input().split())
  print(t[r-1] - t[l-1])
### BUGGY CODE ###

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

for i in range(1, n):
    while a[i-1] + a[i] > x:
        a[i] -= 1
        ans += 1

print(ans)




### FIXED CODE ###

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

if a[0] > x:
    ans += a[0] - x
    a[0] = x

# print(a, ans)

for i in range(1, n):
    total = a[i-1] + a[i]
    if total > x:
        # print('yay,', total-x)
        a[i] -= total - x
        ans += total - x

    # while a[i-1] + a[i] > x:
    #     a[i] -= 1
    #     ans += 1

print(ans)
### BUGGY CODE ###

L = list(input())
n = len(L)-1
div = 10**9+7

number = 1
many = 0
for i in range(1,n+1):
  if int(L[i]) == 1:
    many += (3**(n-i)%div) * (2**number%div)
    number += 1
many += (2**number%div) + (3**n%div)

print(many%div)

### FIXED CODE ###

mod = 10**9+7

#互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

# aの逆元(mod m) (aとmは互いに素)
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m


L = list(input())
n = len(L)-1

#これだとTLEする

'''
number = 1
many = 0
for i in range(1,n+1):
  if int(L[i]) == 1:
    many += 3**(n-i) * 2**number %div
    number += 1
many += 2**number + 3**n
'''

beki3 = 3**n % mod
many = beki3
beki2 = 2
for i in range(1,n+1):
  beki3 = (beki3%mod)*mod_inv(3,mod)%mod
  if int(L[i]) == 1:
    many += beki3*beki2 %mod
    beki2 = beki2*2 %mod
many += beki2 % mod
print(many%mod)
### BUGGY CODE ###

from sys import stdin 
n = int(stdin.readline().rstrip())
s = [int(x) for x in stdin.readline().rstrip().split()]
a = 0
for i in range(len(s)):
    for j in range(i):
        for k in range(j):
            if i != j and j != k and k != i:
                if s[i] < s[j] + s[k] and s[j] < s[k] + s[i] and s[k] < s[i] + s[j]:
                    a += 1
print(a)


### FIXED CODE ###

from sys import stdin 
from bisect import bisect_left
n = int(stdin.readline().rstrip())
l = [int(x) for x in stdin.readline().rstrip().split()]
l.sort()
answer = 0
for i in range(len(l)):
    for j in range(i):
        if i != j:
            k = bisect_left(l, l[i]+ l[j])
            answer += k - i - 1
print(answer)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
max_a = max(a)
b = [False] * (max_a + 1)
a.sort()
a = a + [0]
b[a[0]] = True
count = 0
for i in range(1, n):
    flg = True
    if b[a[i]]:
        continue
    for j in range(i - 1, -1, -1):
        if a[i] % a[j] == 0 or a[i] == a[i+1]:
            flg = False
            b[a[i]] = True
            k = 2
            while k*a[i] < max_a:
                b[k*a[i]] = True
                k += 1
            break
    if flg:
        count += 1

if a[0] != a[1]:
    count += 1
print(count)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
max_a = max(a)
b = [0] * (max_a + 1)
a.sort()

for i in a:
    b[i] += 1
    if b[i] == 1:
        for j in range(2*i, max_a + 1, i):
            b[j] += 2
print(b.count(1))
### BUGGY CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse = True)
while M > 0:
    M -= 1
    A[0] //= 2
    A.sort(reverse = True)
print(sum(A))


### FIXED CODE ###

import heapq

n, m = map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)  # aを優先度付きキューに

for _ in range(m):
    tmp_min = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-tmp_min//2))  # 計算誤差の関係で-1を2回かけてます
print(-sum(a))
### BUGGY CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

from collections import deque

N = int(input())
A = [deque(int(x)-1 for x in row.split()) for row in sys.stdin.readlines()]

for i in range(N):
    A[i].append(-1)
A.append([-1])

def f():
    can_use = [n for n in range(N) if A[A[n][0]][0] == n]
    for n in can_use:
        A[n].popleft()
    return len(can_use)

answer = 0
rest = N*(N-1)
while True:
    answer += 1
    x = f()
    if x == 0:
        answer = -1
        break
    rest -= x
    if rest == 0:
        break

print(answer)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
A = [[-1] + [int(x)-1 for x in row.split()][::-1] for row in sys.stdin.readlines()]

A.append([-1])

def f(cand):
    cand1 = set()
    can_use = []
    for n in cand:
        if A[A[n][-1]][-1] == n:
            can_use.append(n)
    for n in can_use:
        A[n].pop()
        cand1.add(n)
        if A[n][-1] != -1:
            cand1.add(A[n][-1])
    return len(can_use),cand1

answer = 0
rest = N*(N-1)
cand = set(range(N))
while True:
    answer += 1
    x,cand = f(cand)
    if x == 0:
        answer = -1
        break
    rest -= x
    if rest == 0:
        break

print(answer)
### BUGGY CODE ###

from math import factorial
from bisect import bisect

def C(n, r):
	return factorial(n) // factorial(r) // factorial(n-r)

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

z = a.pop()
r = bisect(a, z//2)
l = r - 1

if l < 0:
	print("%d %d" % (z, a[r]))
elif r >= len(a):
	print("%d %d" % (z, a[l]))
elif C(z, a[r]) > C(z, a[l]):
	print("%d %d" % (z, a[r]))
else:
	print("%d %d" % (z, a[l]))


### FIXED CODE ###

n=int(input())
a=list(map(int, input().split()))
b=max(a)
_,c=min([(abs(b/2-x), x) for x in a])
print("%d %d" % (b, c))
### BUGGY CODE ###

def ev(d0, d1, d2, d3):
    if d0 == n:
        return 0
    tp = (d1, d2, d3)
    if tp in memo:
        return memo[tp]
    re = n
    if d1 > 0:
        re += ev(d0 + 1, d1 - 1, d2, d3) * d1
    if d2 > 0:
        re += ev(d0, d1 + 1, d2 - 1, d3) * d2
    if d3 > 0:
        re += ev(d0, d1, d2 + 1, d3 - 1) * d3
    re /=n - d0
    memo[tp] = re
    return re


memo = {}
n = int(input())
a = list(map(int, input().split()))
ds = [0] + [a.count(i) for i in range(1, 4)]
print(ev(0, ds[1], ds[2], ds[3]))


### FIXED CODE ###

import sys
from collections import Counter

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    n = int(input())
    aa = list(map(int, input().split()))
    cnt_aa = Counter(aa)
    nc3 = cnt_aa[3]
    nc2 = cnt_aa[2]
    nc1 = cnt_aa[1]
    dp = [[[0] * (n + 1) for _ in range(nc3 + nc2 + 1)] for _ in range(nc3 + 1)]
    for c3 in range(nc3 + 1):
        for c2 in range(nc2 + nc3 - c3 + 1):
            if c3 + c2 > n: break
            for c1 in range(n + 1):
                s = c1 + c2 + c3
                if s > n: break
                if c1 > 0: dp[c3][c2][c1] += (dp[c3][c2][c1 - 1] + n / s) * c1 / s
                if c2 > 0: dp[c3][c2][c1] += (dp[c3][c2 - 1][c1 + 1] + n / s) * c2 / s
                if c3 > 0: dp[c3][c2][c1] += (dp[c3 - 1][c2 + 1][c1] + n / s) * c3 / s
    print(dp[nc3][nc2][nc1])

main()
### BUGGY CODE ###

import itertools
 
x1 = int(input())
x2 = input()
RGB = {"R", "G", "B"}
_sum = 0
x = [1 for i, rgb in zip(itertools.combinations(range(x1), 3), itertools.combinations(x2, 3)) if set(rgb) == RGB and (i[1] - i[0]) != (i[2] - i[1])]
print(sum(x))

### FIXED CODE ###

from itertools import product

x1 = int(input())
x2 = input()

R_i = [i for i, x in enumerate(x2) if x == "R"]
G_i = [i for i, x in enumerate(x2) if x == "G"]
B_i = {i for i, x in enumerate(x2) if x == "B"}

R = len(R_i)
G = len(G_i)
B = len(B_i)

xs = map(sorted, product(R_i, G_i))

s = 0
for a in xs:
    k = a[1]*2 - a[0]  # 2j-i
    if k in B_i:
        s +=1
    i = a[0]*2 - a[1]  # 2j-k
    if i in B_i:
        s +=1
    j = (a[0] + a[1]) / 2
    if j.is_integer():
        j = int(j)
        if j in B_i:
            s +=1
print(R*G*B - s)
### BUGGY CODE ###

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

l = {}

for a in A:
    if a in l.keys():
        l[a] += 1
    else:
        l[a] = 1

# 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]

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

ans = 0
for a in A:
    flag = True
    # da = make_divisors(a)
    da = divisor(a)
    for d in da:
        if d != a:
            if d in l.keys():
                flag = False
                break
        elif l[d] >= 2:
            flag = False
            break
    if flag:
        ans += 1

print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline

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

l = [0]*1000001

A.sort()

for a in A:
    if l[a] == 0:
        l[a] = 1
        tmp = 2
        while tmp*a <= 1000000:
            l[tmp*a] = 2
            tmp+=1
    elif l[a] == 1:
        l[a] = 2

ans = 0
for a in A:
    if l[a] != 2:
        ans += 1

print(ans)
### BUGGY CODE ###

import collections
import sys
def input():
    return sys.stdin.readline()[:-1]
  
n = int(input())
a = [int(i) for i in input().split()]

dic = collections.defaultdict(int)
for i in range(n):
    dic[a[i]] += 1

ls = collections.deque()
for i in dic.keys():
    if dic[i] > 1:
        ls.append(i)

ans = n

for i in range(n//2):
    if max(dic.values()) == 1:
        break
    if len(ls) == 1 and dic[ls[0]] == 2:
        ans -= 2
        dic[ls[0]] -= 1
        break
    else:
        if len(ls) == 1:
            dic[ls[0]] -= 2
        else:
            dic[ls[0]] -= 1
            dic[ls[-1]] -= 1
        ans -= 2

    if dic[ls[0]] <= 1:
        ls.popleft()
    if len(ls) > 1:
        if dic[ls[-1]] <= 1:
            ls.pop()

print(ans)


### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]

import collections

n = int(input())
a = [int(i) for i in input().split()]

dic = collections.defaultdict(int)
for i in range(n):
    dic[a[i]] += 1

ls = collections.deque()
for i in dic.keys():
    if dic[i] > 1:
        ls.append(i)

ans = n
if len(ls) > 0:
#n/2回ループ
    for i in range(n//2):
        if len(ls) == 1 and dic[ls[0]] == 2:
            ans -= 2
            dic[ls[0]] -= 1
            break
        else:
            if len(ls) == 1:
                dic[ls[0]] -= 2
            else:
                dic[ls[0]] -= 1
                dic[ls[-1]] -= 1
            ans -= 2

        if len(ls) > 1:
            if dic[ls[-1]] <= 1:
                ls.pop()
        if dic[ls[0]] <= 1:
            ls.popleft()

        if len(ls) == 0:
            break
print(ans)