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

K=int(input())
def gcd(a,b):
    if a <b:
        a,b=b,a
    while a%b != 0:
        a,b= b,a%b
    return b
x=0
for i in range(1,K+1):
    for j in range(1,K+1):
        for l in range(1,K+1):
            if (i==1) or (j==1) or (l==1):
                x+=1
            else:
                x += gcd(gcd(i,j),l)
print(x)

### FIXED CODE ###

K=int(input())
def gcd(a,b,c):
    if a <b:
        a,b=b,a
    while a%b != 0:
        a,b= b,a%b
    if b < c:
        b,c=c,b
    while b % c != 0:
        b,c = c,b%c
    return c
x=0
for i in range(1,K+1):
    for j in range(1,K+1):

            for l in range(1,K+1):
                
                    if (i==1) or (j==1) or (l==1):
                        x+=1
                    else:
                        x += gcd(i,j,l)
print(x)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys

def main():
    input = sys.stdin.readline  
    H,W = map(int,input().split())
    isVisited = [[-1]*W for _ in range(H)]
    from collections import deque
    queue = deque()

    for i in range(H):
        st = input()
        for j in range(W):
            if st[j] == "#":
                queue.append((i,j,0))

    answer = 0
    while queue:
        i,j,count = queue.popleft()

        if isVisited[i][j] == -1:
            isVisited[i][j] = count
            if count>answer:
                answer = count
            for ix,iy in [(0,1),(1,0),(-1,0),(0,-1)]:
                if 0<=i+ix<H and 0<=j+iy<W:
                    queue.append((i+ix,j+iy,count+1))
 
    print(answer)
    return

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
from collections import deque

def main():
    input = sys.stdin.readline  
    H,W = map(int,input().split())
    isVisited = [[False]*W for _ in range(H)]
    queue = deque()

    for i in range(H):
        st = input()
        for j in range(W):
            if st[j] == "#":
                queue.append((i,j))

    answer = 0
    a =  [(0,1),(1,0),(-1,0),(0,-1)]
    while True:
        nqueue = deque()
        while queue:
            i,j = queue.popleft()

            if not isVisited[i][j]:
                isVisited[i][j] = True
                for ix,iy in a:
                    if 0<=i+ix<H and 0<=j+iy<W:
                        nqueue.append((i+ix,j+iy))
        
        if nqueue:
            answer += 1
            queue = nqueue
        else:
            break
 
    print(max(answer-1,0))
    return

if __name__ == '__main__':
    main()
### BUGGY CODE ###

#D
N, K = map(int, input().split())
P = list(map(int, input().split()))
ans = 0

for i in range(0, N-K+1):
    sum_P = sum(P[i:i+K])
    ans = max(ans, K+0.5*(sum_P-K))
    
print(ans)

### FIXED CODE ###

#D
N, K = map(int, input().split())
P = list(map(int, input().split()))
ans = sum(P[0:K])
sum_P = ans

for i in range(1, N-K+1):
    sum_P = sum_P - P[i-1] + P[i+K-1]
    ans = max(ans, sum_P)
#     ans = max(ans, K+0.5*(sum_P-K))
    
print(K+0.5*(ans-K))
### BUGGY CODE ###

import numpy as np
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()))
a.sort()
flag = [True] * n
for i, num in enumerate(a):
    div = make_divisors(num)
    for d in div:
        if d == num:
            if a.count(d)>1:
                flag[i] = False
            continue
        if d in a:
            flag[i] = False
print(np.count_nonzero(flag))

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
a.sort()
flag = [True] * (a[-1]*3)
for i, num in enumerate(a):
    if a[(i-1)%n]==num or a[(i+1)%n]==num:
        if i-1>=0 or i+1<n:
            flag[num] = False
    for j in range(2, a[-1]//num+2):
        flag[j*num] = False
counter = 0
for i in a:
    if flag[i]:
        counter += 1
print(counter)
### BUGGY CODE ###

m=0
def merge(a,left,mid,right):
    n1=mid-left
    n2=right-mid
    el=list(range(0,n1+1))
    ar=list(range(0,n2+1))
    for i in range(n1):
        el[i]=a[left+i]
    for i in range(n2):
        ar[i]=a[mid+i]
    el[n1]=float("inf")
    ar[n2]=float("inf")
    i=0
    j=0
    for k in range(left,right):
        global m
        m+=1
        if(el[i] <= ar[j]):
            a[k] = el[i]
            i=i+1
        else:
            a[k]=ar[j]
            j=j+1

def merge_sort(a,left,right):
    if(left+1<right):
        mid=(left+right)//2
        merge_sort(a,left,mid)
        merge_sort(a,mid,right)
        merge(a,left,mid,right)


n=int(input())
s=input()
a=list(map(int,s.split()))
merge_sort(a,0,n)
a=map(str,a)
print(" ".join(list(a)))
print(m)
    

### FIXED CODE ###

m=0
def merge(a,left,mid,right):
    n1=mid-left
    n2=right-mid
    el=a[left:mid]
    ar=a[mid:right]
    el.append(float("inf"))
    ar.append(float("inf"))
    i=0
    j=0
    for k in range(left,right):
        global m
        m+=1
        if(el[i] <= ar[j]):
            a[k] = el[i]
            i=i+1
        else:
            a[k]=ar[j]
            j=j+1

def merge_sort(a,left,right):
    if(left+1<right):
        mid=(left+right)//2
        merge_sort(a,left,mid)
        merge_sort(a,mid,right)
        merge(a,left,mid,right)
    else:
        if(a[left]>a[right-1]):
            a[left],a[right-1]=a[right],a[left]



n=int(input())
s=input()
a=list(map(int,s.split()))
merge_sort(a,0,n)
a=map(str,a)
print(" ".join(list(a)))
print(m)
### BUGGY CODE ###

MOD = 998244353

N, K = map(int,input().split())
S = []
for _ in range(K):
    L, R = map(int,input().split())
    for i in range(L,R+1):
        if i not in S:
            S.append(i)

# dp[i]: マスiに移動する方法
dp = [0] * 200010
dp[0] = 1

for i in range(N):
    for d in S:
        if i+d < N:
            dp[i+d] += dp[i]
            dp[i+d] %= MOD

print(dp[N-1])


### FIXED CODE ###

MOD = 998244353

N, K = map(int,input().split())
LR = [list(map(int,input().split())) for _ in range(K)]

# dp[i]: マスiに移動する方法
dp = [0] * 200010
dp[0] = 1

for i in range(N):
    for l, r in LR:
        if i+l < N:
            dp[i+l] += dp[i]
            dp[i+l] %= MOD
        if i+r < N:
            dp[i+r+1] -= dp[i]
            dp[i+r+1] %= MOD
    if i>=1:
        dp[i+1] += dp[i]
        dp[i+1] %= MOD

print(dp[N-1])
### BUGGY CODE ###

x,k,d = map(int, input().split())
line = [x]
if abs(x) >= k*d:
  print(abs(x) - k*d)
else:
  for i in range(k):
    if x > 0:
      x -= d
    else:
      x += d
    line.append(x)
    if i != 0:
      if line[i-1] == line[i+1]:
        if (k - i + 1) % 2 == 0:
          x = line[i+1]
          break
        else:
          x = line[i]
          break
  print(abs(x))

### FIXED CODE ###

x,k,d = map(int, input().split())
count = abs(x) // d
if count >= k:
  print(abs(x)-k*d)
else:
  if (k - count) % 2 == 0:
    print(abs(x)-count*d)
  else:
    print(abs(abs(x)-(count+1)*d))
### BUGGY CODE ###

def main():
    string = input()
    lists = list(string)
    original_len = len(lists)
    for i in range(int(len(lists))):
        pre = 2
        for j, now in enumerate(lists):
            if(int(pre) < 2 and int(pre) != int(now)):
                del lists[j]
                del lists[j-1]
                #print(j, lists)
                break
            pre = lists[j]
    print(original_len - len(lists))
if __name__ == "__main__":
    main()



### FIXED CODE ###

def main():
    string = input()
    lists = list(string)
    original_len = len(lists)
    zero = lists.count('0')
    one = lists.count('1')
    print(min(zero,one)*2)
if __name__ == "__main__":
    main()
### BUGGY CODE ###

import math
N = int(input())
ans = 0

upper = int(math.sqrt(N/2)) + 1
for n in range(1, N+1):
    ans = 0
    for x in range(1, upper):
        for y  in range(1, upper):
            z = 0
            v = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if v > n:
                break
            for z in range(1, upper):
                v = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if  v == n:
                    ans += 1
                    #print((x, y, z))
                elif v > n:
                    break
    print(ans)

### FIXED CODE ###

import math
N = int(input())
ans = 0
num = {i:0 for i in range(1, N+1)}
upper = int(math.sqrt(N)) + 1
for x in range(1, upper):
    for y  in range(1, upper):
        z = 1
        v = x**2 + y**2 + z**2 + x*y + y*z + z*x
        if v > N:
            break
        for z in range(1, upper):
            v = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if v in num.keys():
                num[v] += 1
            if v > N:
                break
for n in range(1, N+1):
    print(num[n])
### BUGGY CODE ###

N, C = list(map(int,input().split()))
x_list = [0]
v_list = []

for i in range(N):
    x, v = list(map(int,input().split()))
    x_list.append(x)
    v_list.append(v)

max_c = 0

threshold_x = max(x_list)

# 時計回りスタート
for i in range(N):
#    print("------")
#    print(i)
    c = 0
    th = 0
    x_tmp = x_list.copy()
    v_tmp = v_list.copy()
    for j in range(i):
        c += v_tmp[j]
#        print(v_tmp[j],"を食べた")
        c -= x_tmp[j+1] - x_tmp[j]
        th += x_tmp[j+1] - x_tmp[j]
        if th > threshold_x:
            break
#        print(c)
        if max_c < c:
            max_c = c
    if th > threshold_x:
        break
    
    x_tmp = x_tmp[i:]
    v_tmp = v_tmp[i:]
    
    v_tmp = v_tmp[::-1]
    
    x_tmp = [x_tmp[0]+C] + x_tmp[1:][::-1]
    
#    print(x_tmp)
#    print(v_tmp)
    
    for j in range(N - i):
        c += v_tmp[j]
#        print(v_tmp[j],"を食べた")
        c -= x_tmp[j] - x_tmp[j+1]
        th += x_tmp[j+1] - x_tmp[j]
        if th > threshold_x:
            break
#        print(c)
        if max_c < c:
            max_c = c
    if th > threshold_x:
        break
            
# 反時計回りスタート
# xとvの置き換えることで対応する
x_list = [x_list[0]] + [C-x for x in x_list[1:][::-1]]
v_list = v_list[::-1]
for i in range(N):
#    print("------")
#    print(i)
    c = 0
    th = 0
    x_tmp = x_list.copy()
    v_tmp = v_list.copy()
    for j in range(i):
        c += v_tmp[j]
#        print(v_tmp[j],"を食べた")
        c -= x_tmp[j+1] - x_tmp[j]
        th += x_tmp[j+1] - x_tmp[j]
        if th > threshold_x:
            break
#        print(c)
        if max_c < c:
            max_c = c
    if th > threshold_x:
        break
    
    x_tmp = x_tmp[i:]
    v_tmp = v_tmp[i:]
    
    v_tmp = v_tmp[::-1]
    
    x_tmp = [x_tmp[0]+C] + x_tmp[1:][::-1]
    
#    print(x_tmp)
#    print(v_tmp)
    
    for j in range(N - i):
        c += v_tmp[j]
#        print(v_tmp[j],"を食べた")
        c -= x_tmp[j] - x_tmp[j+1]
        th += x_tmp[j+1] - x_tmp[j]
        if th > threshold_x:
            break
#        print(c)
        if max_c < c:
            max_c = c
    if th > threshold_x:
        break

            
print(max_c)

### FIXED CODE ###

# kopipe
from numpy import array as n

N, C = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(N)]
r1, r2, l1, l2 = [0],[0],[0],[0]
sum = 0
for x, cal in xy:
    sum += cal
    r1.append(max(r1[-1], sum-x))
    r2.append(max(r2[-1], sum-2*x))
sum = 0
for x, cal in xy[::-1]:
    sum += cal
    l1.append(max(l1[-1], sum-C+x))
    l2.append(max(l2[-1], sum-2*(C-x)))
a = max(n(r1)+n(l2[::-1]))
b = max(n(r2)+n(l1[::-1]))
print(max(a,b))
### BUGGY CODE ###

n=int(input())
s=input()
count=0
for i in range(1000):
    if (i<10):
        num="00"+str(i)
    elif (i<100):
        num="0"+str(i)
    else:
        num=str(i)
    k=0
    flag=num[0]
    for j in range(len(s)):
        if (flag==s[j]):
            if (k<2):
                k=k+1
                flag=num[k]
            elif (k==2):
                count+=1
                #print(num)
                break
print(count)

### FIXED CODE ###

n=int(input())
s=input()
count=0
for i in range(10):
    for j in range(10):
        for k in range(10):
            num=str(i)+str(j)+str(k)
            a=s.find(num[0])
            if (a==-1):
                continue
            b=s[a+1::].find(num[1])
            if (b==-1):
                continue
            c=s[a+b+2::].find(num[2])
            if (c==-1):
                continue
            count+=1
            #print(num,a,b,c)
        ##
    ##
##
print(count)
### BUGGY CODE ###

MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))

ans = 0
twopow = 1
for n in range(60):
    one = sum( ((Ai >> n) & 1) for Ai in A )
    zero = N - one
    ans = (ans + (one * zero) * twopow) % MOD
    twopow = twopow << 1 % MOD

print(ans)

### FIXED CODE ###

import numpy as np
MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))
A = np.array(A)

ans = 0
twopow = 1
for n in range(60):
    tmp = A & 1
    one = np.count_nonzero(tmp)
    zero = N - one
    ans = (ans + (one * zero) * twopow) % MOD
    A >>= 1
    twopow = twopow << 1 % MOD

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

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

array=[0]*n

for i in reversed(range(1,n+1)):
  sum = 0
  for j in range(i,n+1,i):
    sum += array[j-1]
  if array[i-1] != (sum-moto[i-1])%2:
    array[i-1] = 1

m = array.count(1)
ans = ""
cnt = 0
for a in array:
  cnt += 1
  if a == 1:
    ans = ans + str(cnt) + " "
print(m)
if ans != "":
  print(ans[:-1])


### FIXED CODE ###

n = int(input())
moto = [int(i) for i in input().split()]
 
array=[0]*n
 
for i in reversed(range(1,n+1)):
  if sum(array[i-1::i])%2 != moto[i-1]:
    array[i-1] = 1
    
m = sum(array)
print(m)
ans = ""
for i in range(n):
  if array[i] == 1:
    print(i+1, end=" ")
### BUGGY CODE ###

N=int(input())
A = list(map(int, input().split()))
C=[0]*N
for i in range(0,N):
    C[i]=A.index(i+1)+1
print(*C)

### FIXED CODE ###

N=int(input())
A = list(map(int, input().split()))
C=[0]*N
for i in range(0,N):
    C[A[i]-1]=i+1
print(*C)
### BUGGY CODE ###

# ABC 056 C
X =int(input())
L = [int(i) for i in range(X+1)]
from itertools import accumulate
for ind,val in enumerate(list(accumulate(L))):
    if val >=X:
        print(ind)
        exit()

### FIXED CODE ###

# ABC 056 C
X =int(input())
for t in range(10**9):
    if t * (t+1)/2 >=X:
        print(t)
        exit()
### BUGGY CODE ###

H,W=map(int,input().split())
red=[]
blue=[]
for i in range(H):
  A=list(map(int,input().split()))
  red.append(A)
for i in range(H):
  B=list(map(int,input().split()))
  blue.append(B)
list=[[[0 for i in range(12801)] for j in range(W)] for k in range(H)]
list[0][0][abs(red[0][0]-blue[0][0])]=1
for i in range(H):
  for j in range(W):
    for k in range(12801):
      if list[i][j][k]==1:
        if i+1<H:
          if abs(k-abs(red[i+1][j]-blue[i+1][j]))<12801: 
            list[i+1][j][abs(k-abs(red[i+1][j]-blue[i+1][j]))]=1
          if abs(k+abs(red[i+1][j]-blue[i+1][j]))<12801: 
            list[i+1][j][abs(k+abs(red[i+1][j]-blue[i+1][j]))]=1
        if j+1<W:
          if abs(k-abs(red[i][j+1]-blue[i][j+1]))<12801: 
            list[i][j+1][abs(k-abs(red[i][j+1]-blue[i][j+1]))]=1
          if abs(k+abs(red[i][j+1]-blue[i][j+1]))<12801: 
            list[i][j+1][abs(k+abs(red[i][j+1]-blue[i][j+1]))]=1           
for i in range(12801):
  if list[H-1][W-1][i]==1:
    print(i)
    break

### FIXED CODE ###

H,W=map(int,input().split())
red=[]
blue=[]
for i in range(H):
  A=list(map(int,input().split()))
  red.append(A)
for i in range(H):
  B=list(map(int,input().split()))
  blue.append(B)
list=[[[0 for i in range(80*(j+k+1)+1)] for j in range(W)] for k in range(H)]
list[0][0][abs(red[0][0]-blue[0][0])]=1
for i in range(H):
  for j in range(W):
    for k in range(len(list[i][j])):
      if list[i][j][k]==1:
        if i+1<H:
          if abs(k-abs(red[i+1][j]-blue[i+1][j]))<=80*(i+j+2): 
            list[i+1][j][abs(k-abs(red[i+1][j]-blue[i+1][j]))]=1
          if abs(k+abs(red[i+1][j]-blue[i+1][j]))<=80*(i+j+2): 
            list[i+1][j][abs(k+abs(red[i+1][j]-blue[i+1][j]))]=1
        if j+1<W:
          if abs(k-abs(red[i][j+1]-blue[i][j+1]))<=80*(i+j+2): 
            list[i][j+1][abs(k-abs(red[i][j+1]-blue[i][j+1]))]=1
          if abs(k+abs(red[i][j+1]-blue[i][j+1]))<=80*(i+j+2): 
            list[i][j+1][abs(k+abs(red[i][j+1]-blue[i][j+1]))]=1           
for i in range(12801):
  if list[H-1][W-1][i]==1:
    print(i)
    break
### BUGGY CODE ###

s = input()
q = int(input())
count = 1
rc = 0
while count < q+1:
    line = list(input())
    if line[0] == "2":
        if rc%2 != 0:
            s = s[::-1]
            rc = 0
        if line[2] == "1":
            s = line[4] + s
        else:
            s = s + line[4]
    else:
        rc += 1
    count += 1
if rc%2 != 0:
    s = s[::-1]
print(s)

### FIXED CODE ###

s = input()
q = int(input())
list1 = []
list2 = []
flag = 1
for i in range(q):
    in_line = input().split()
    if in_line[0] == "1":
        flag *= -1
    else:
        if in_line[1] == "1":
            if flag == 1:
                list1.append(in_line[2])
            else:
                list2.append(in_line[2])
        else:
            if flag == 1:
                list2.append(in_line[2])
            else:
                list1.append(in_line[2])
if flag == 1:
    print("".join(list1[::-1]) + s + "".join(list2))
else:
    print("".join(list2[::-1]) + s[::-1] + "".join(list1))
### BUGGY CODE ###

N=int(input())
#dp[i]...i日間で得られる幸福度の最大値
INF = 10**18
dp =[]
for _ in range(N):
    dp.append([INF] * (N+1))
dp[0] = list(map(int,input().split()))
#print(dp)
for i in range(1, N):
    #変えたいのはdp[1][0〜2]
    day = list(map(int,input().split()))
    d_temp = [dp[i-1][k]+day[j] for j in range(3) for k in range(3) if k!=j]
    #print(d_temp)
    dp[i]=[max(d_temp[2*x:2*x+2]) for x in range(3)]
print(max(dp[N-1]))


### FIXED CODE ###

N=int(input())
dp =[[0]*3 for _ in range(N)]
dp[0]= list(map(int,input().split()))
for i in range(1,N):
    a,b,c=map(int,input().split())
    dp[i][0] = a+max(dp[i-1][1], dp[i-1][2])
    dp[i][1] = b+max(dp[i-1][2], dp[i-1][0])
    dp[i][2] = c+max(dp[i-1][0], dp[i-1][1])
print(max(dp[N-1]))
### BUGGY CODE ###

N, M = map(int, input().split())

C = [1] * N

for i in range(M):
    a, b = map(int, input().split())
    a = a - 1
    if a != 0:
        C[:a] = [0] * a
    if b-1 != len(C):
        C[b:] = [0] * (len(C) - b)

print(sum(C))


### FIXED CODE ###

N, M = map(int, input().split())

L = []
R = []
l = 0
r = 10 ** 6
for i in range(M):
    a,b = map(int, input().split())
    L.append(a)
    R.append(b)

for i in range(M):
    if l < L[i]:
        l = L[i]
    if r > R[i]:
        r = R[i]

ans = r-l+1
if ans > 0:
    print(ans)
else:
    print("0")
### BUGGY CODE ###

import sys
input = sys.stdin.readline
n = int(input())
s = list(input())
q = int(input())
for i in range(q):
  que = input().split()
  if que[0] == '1':
    na,mu = que[1],que[2]
    na = int(na)
    s[na-1] = mu
  else:
    na,mu = que[1],que[2]
    na,mu = int(na),int(mu)
    c = set(s[na-1:mu])
    print(len(c))

### FIXED CODE ###

import sys
readline = sys.stdin.readline

from bisect import bisect_left, insort_left

def main():
    n = int(readline())
    s = list(readline().rstrip())
    q = int(readline())
    
    chk_abc = [[] for i in range(26)]
    for i, si in enumerate(s):
        ci = ord(si) - 97
        chk_abc[ci].append(i)
        
    ans = []
    for _ in range(q):
        cmd, i, j = readline().rstrip().split()
        i = int(i) - 1
        
        if cmd == "1":
            if s[i] == j:
                continue
            c1 = ord(s[i]) - 97
            prev = chk_abc[c1]
            c2 = ord(j) - 97
            prev.pop(bisect_left(prev, i))
            s[i] = j
            insort_left(chk_abc[c2], i)
            
        else:
            j = int(j) - 1
            num = 0
            for chk in chk_abc:
                le = len(chk)
                k = bisect_left(chk, i, 0, le)
                if k == le:
                    continue
                if i <= chk[k] <= j:
                    num += 1
            ans.append(num)

    print(*ans, sep="\n")

if __name__ == "__main__":
    main()
### BUGGY CODE ###

S = input()
Q = int(input())
muki = 1
one = ''
two = ''

for i in range(Q):
    I = input().split()
    if I[0] == '1':
        muki *= -1
    elif I[0] == '2':
        F = int(I[1])
        C = I[2]
        if F==1:
            if muki == 1:
                t = [one, C ]
                one = ''.join(t)
            else:
                t = [two, C ]
                two = ''.join(t)
        elif F==2:
            if muki == 1:
                t = [two, C ]
                two = ''.join(t)
            else:
                t = [one, C ]
                one = ''.join(t)
if muki == 1:
    ANS = [one[::-1],S,two]
    print(''.join(ANS))
else:
    ANS = [two[::-1],S[::-1],one]
    print(''.join(ANS))

### FIXED CODE ###

S = input()
Q = int(input())
muki = 1
one = ''
two = ''

for i in range(Q):
    I = input().split()
    if I[0] == '1':
        muki *= -1
    elif I[0] == '2':
        F = int(I[1])
        C = I[2]
        if F==1:
            if muki == 1:
                t = [one, C ]
                one = ''.join(t)
            else:
                t = [two, C ]
                two = ''.join(t)
        elif F==2:
            if muki == 1:
                t = [two, C ]
                two = ''.join(t)
            else:
                t = [one, C ]
                one = ''.join(t)
if muki == 1:
    ANS = [one[::-1],S,two]
    print(''.join(ANS))
else:
    ANS = [two[::-1],S[::-1],one]
    print(''.join(ANS))
### BUGGY CODE ###

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

dic={}
for i in range(N):
    if A[i] not in dic:
        dic[A[i]]=1
    else:
        dic[A[i]]+=1

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

if 1 in dic:
    if dic[1]>1:
        print(0)
        exit()
    else:
        print(1)
        exit()

def make_divisors(n):
    divisors=[]
    for i in range(2, int(n**0.5)+1):
        if n%i==0:
            divisors.append(i)
            if i!=n//i:
                divisors.append(n//i)
 
    return divisors

ans=0
for i in range(N):
    if dic[A[i]]>1:
        continue
    f=False
    div=make_divisors(A[i])
    for d in div:
        if d in dic:
            f=True
            break
    if f:
        continue
    ans+=1

print(ans)

### FIXED CODE ###

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

M=max(A)
check=[0]*(M+1)
for i in range(N):
    a=A[i]
    while a<=M:
        check[a]+=1
        a+=A[i]
ans=0
for i in range(N):
    if check[A[i]]==1:
        ans+=1

print(ans)